Reputation: 150624
Say, I have a Node.js application that connects to a web server. At some point in time, I need to end this application.
Now I have two options:
process.exit()
Of course, the first approach is much more brute-force, but it's also way less coding ;-).
Are there any disadvantages I should be aware of when doing it like this? In other words: Could this result in not-cleaned up resources, like still-open sockets (either on the client, or on the server)? Does this affect when the server cleans up its resources for this connection, or is this done immediately?
Upvotes: 2
Views: 787
Reputation: 1715
I put myself the same question when trying to decide the best way to handle errors and I foud very useful the following:
in particular the section "The best way to recover from programmer errors is to crash immediately".
Upvotes: 2