bjskistad bjskistad - 1 year ago 65
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.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download