Skip to content

Commit

Permalink
Address nits
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Apr 28, 2016
1 parent 1af3825 commit 948a79a
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit 948a79a

Please sign in to comment.