Skip to content

Commit

Permalink
Docs: no-process-exit: recommend process.exitCode (#10478)
Browse files Browse the repository at this point in the history
* Docs: no-process-exit: recommend process.exitCode

* Docs: added Node.js version info for process.exitCode
  • Loading branch information
mjomble authored and platinumazure committed Jun 18, 2018
1 parent f93d6ff commit 077358b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/rules/no-process-exit.md
Expand Up @@ -19,6 +19,8 @@ if (somethingBadHappened) {

By throwing an error in this way, other parts of the application have an opportunity to handle the error rather than stopping the application altogether. If the error bubbles all the way up to the process without being handled, then the process will exit and a non-zero exit code will returned, so the end result is the same.

If you are using `process.exit()` only for specifying the exit code, you can set [`process.exitCode`](https://nodejs.org/api/process.html#process_process_exitcode) (introduced in Node.js 0.11.8) instead.

## Rule Details

This rule aims to prevent the use of `process.exit()` in Node.js JavaScript. As such, it warns whenever `process.exit()` is found in code.
Expand Down

0 comments on commit 077358b

Please sign in to comment.