Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address nits
  • Loading branch information
jasnell committed Apr 28, 2016
commit 948a79a6b5d5ceb003c8ca9a29462632cc2b67c4
10 changes: 7 additions & 3 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ Example:

* `code` {Integer} The exit code. Defaults to `0`.

The `process.exit()` methods instructs Node.js to terminate the process as
The `process.exit()` method instructs Node.js to terminate the process as
quickly as possible with the specified exit `code`. If the `code` is omitted,
exit uses either the 'success' code `0` or the value of `process.exitCode` if
specified.
Expand All @@ -723,8 +723,8 @@ The shell that executed Node.js should see the exit code as `1`.

It is important to note that calling `process.exit()` will force the process to
exit as quickly as possible *even if there are still asynchronous operations
pending* in the event loop, *including* i/o operations to `process.stdout` and
`process.stderr`.
pending* that have not yet completed fully, *including* I/O operations to
`process.stdout` and `process.stderr`.

In most situations, it is not actually necessary to call `process.exit()`
explicitly. The Node.js process will exit on it's own *if there is no additional
Expand Down Expand Up @@ -761,6 +761,10 @@ if (someConditionNotMet()) {
}
```

If it is necessary to terminate the Node.js process due to an error condition,
throwing an *uncaught* error and allowing the process to terminate accordingly
is safer than calling `process.exit()`.

## process.exitCode

A number which will be the process exit code, when the process either
Expand Down