bjskistad bjskistad - 11 months ago 42
Node.js Question

What's the difference between abort() and exit() in Node?

I noticed that both

both stop a script. What are the differences between the two besides that one logs

Answer Source

process.abort() stops the process immediately.

process.exit([exitCode]) method instructs Node.js to terminate the process as quickly as possible. You can also specify an exit code.

For exit codes:

  • 0 means the process was exited successfully.
  • 1 means it ended abnormally.
  • When omitted, 0 is the default value.