From 6de7b635a6185115975248efbc71fb8c205b59b6 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 3 Mar 2020 16:35:37 -0800 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/32079 Reviewed-By: Bartosz Sosnowski Reviewed-By: Ruben Bridgewater --- doc/api/process.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index 59e64de17fe2bd..88068a0e0caa1b 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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()`