Browse Source

doc: refine process.kill() and exit explanations

Add corrections about when exit event fires and how .kill() works on
Windows.

PR-URL: https://github.com/nodejs/node/pull/2918
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
v5.x
Rich Trott 9 years ago
parent
commit
4dcf24cfab
  1. 10
      doc/api/process.markdown

10
doc/api/process.markdown

@ -59,8 +59,8 @@ finished running the process will exit. Therefore you **must** only perform
checks on the module's state (like for unit tests). The callback takes one checks on the module's state (like for unit tests). The callback takes one
argument, the code the process is exiting with. argument, the code the process is exiting with.
This event may not be fired if the process terminates due to signals like This event is only emitted when node exits explicitly by process.exit() or
`SIGINT`, `SIGTERM`, `SIGKILL`, and `SIGHUP`. implicitly by the event loop draining.
Example of listening for `exit`: Example of listening for `exit`:
@ -240,12 +240,12 @@ Note:
- `SIGKILL` cannot have a listener installed, it will unconditionally terminate - `SIGKILL` cannot have a listener installed, it will unconditionally terminate
Node.js on all platforms. Node.js on all platforms.
- `SIGSTOP` cannot have a listener installed. - `SIGSTOP` cannot have a listener installed.
- Sending `SIGINT`, `SIGTERM`, and `SIGKILL` cause the unconditional exit of the
target process.
Note that Windows does not support sending Signals, but Node.js offers some Note that Windows does not support sending Signals, but Node.js offers some
emulation with `process.kill()`, and `child_process.kill()`. Sending signal `0` emulation with `process.kill()`, and `child_process.kill()`. Sending signal `0`
can be used to test for the existence of a process can be used to test for the existence of a process. Sending `SIGINT`,
`SIGTERM`, and `SIGKILL` cause the unconditional termination of the target
process.
## process.stdout ## process.stdout

Loading…
Cancel
Save