Skip to content

Commit fa78aa4

Browse files
sam-githubMylesBorins
authored andcommitted
doc: clarify windows specific behaviour
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>
1 parent 2248ba7 commit fa78aa4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

doc/api/process.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,17 @@ process.on('SIGTERM', handle);
518518
the process hanging in an endless loop, since listeners attached using
519519
`process.on()` are called asynchronously and therefore unable to correct the
520520
underlying problem.
521-
522-
Windows does not support sending signals, but Node.js offers some emulation
523-
with [`process.kill()`][], and [`subprocess.kill()`][]. Sending signal `0` can
524-
be used to test for the existence of a process. Sending `SIGINT`, `SIGTERM`,
525-
and `SIGKILL` cause the unconditional termination of the target process.
521+
* `0` can be sent to test for the existence of a process, it has no effect if
522+
the process exists, but will throw an error if the process does not exist.
523+
524+
Windows does not support signals so has no equivalent to termination by signal,
525+
but Node.js offers some emulation with [`process.kill()`][], and
526+
[`subprocess.kill()`][]:
527+
* Sending `SIGINT`, `SIGTERM`, and `SIGKILL` will cause the unconditional
528+
termination of the target process, and afterwards, subprocess will report that
529+
the process was terminated by signal.
530+
* Sending signal `0` can be used as a platform independent way to test for the
531+
existence of a process.
526532

527533
## `process.abort()`
528534
<!-- YAML

0 commit comments

Comments
 (0)