What is the command that is used to exit? (i.e terminate the Node.js process)
Call the global process object's exit method:
process
exit
process.exit()
From the docs:
process.exit([exitcode]) Ends the process with the specified code. If omitted, exit uses the 'success' code 0. To exit with a 'failure' code: process.exit(1); The shell that executed node should see the exit code as 1.
process.exit([exitcode])
Ends the process with the specified code. If omitted, exit uses the 'success' code 0.
code
0
To exit with a 'failure' code:
process.exit(1);
The shell that executed node should see the exit code as 1.
1
2.1m questions
2.1m answers
60 comments
57.0k users