NodeJs - ExitCode

I think NodeJs was initally designed to act as a webserver. You have to stop programs that you write with a Control/C.

But sometimes you want a script to end, either due to sa showstopper error, or because the process has completed.
Use the command

1
2
3
Process.exit(0);			// this is a forced exit. Not really recommended

Process.exitCode=1; // this will exit gracefully. Threads will be properly closed, etc.

References