Skip to content

Commit

Permalink
doc: clarify windows specific behaviour
Browse files Browse the repository at this point in the history
It was not possible to understand which, if either, of the sentences
after the first ("Windows does not... emulation") apply specifically to
Windows.  Specifically, `kill(pid, 0)` works on Linux and Windows and I
couldn't find it documented anywhere else, but the unconditional
termination occurs only on Windows.

PR-URL: #32079
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
sam-github authored and MylesBorins committed Mar 11, 2020
1 parent 2248ba7 commit fa78aa4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,17 @@ process.on('SIGTERM', handle);
the process hanging in an endless loop, since listeners attached using
`process.on()` are called asynchronously and therefore unable to correct the
underlying problem.

Windows does not support sending signals, but Node.js offers some emulation
with [`process.kill()`][], and [`subprocess.kill()`][]. Sending signal `0` can
be used to test for the existence of a process. Sending `SIGINT`, `SIGTERM`,
and `SIGKILL` cause the unconditional termination of the target process.
* `0` can be sent to test for the existence of a process, it has no effect if
the process exists, but will throw an error if the process does not exist.

Windows does not support signals so has no equivalent to termination by signal,
but Node.js offers some emulation with [`process.kill()`][], and
[`subprocess.kill()`][]:
* Sending `SIGINT`, `SIGTERM`, and `SIGKILL` will cause the unconditional
termination of the target process, and afterwards, subprocess will report that
the process was terminated by signal.
* Sending signal `0` can be used as a platform independent way to test for the
existence of a process.

## `process.abort()`
<!-- YAML
Expand Down

0 comments on commit fa78aa4

Please sign in to comment.