@@ -1557,6 +1557,10 @@ re-raise the handled signal.
15571557
15581558See waitpid(2).
15591559
1560+ When ` code` is ` null ` due to signal termination, you can use
1561+ [` util .convertProcessSignalToExitCode ()` ][] to convert the signal to a POSIX
1562+ exit code.
1563+
15601564### Event: ` ' message' `
15611565
15621566<!-- YAML
@@ -1671,6 +1675,11 @@ within the child process to close the IPC channel as well.
16711675The ` subprocess .exitCode ` property indicates the exit code of the child process.
16721676If the child process is still running, the field will be ` null ` .
16731677
1678+ When the child process is terminated by a signal, ` subprocess .exitCode ` will be
1679+ ` null ` and [` subprocess .signalCode ` ][] will be set. To get the corresponding
1680+ POSIX exit code, use
1681+ [` util .convertProcessSignalToExitCode (subprocess .signalCode )` ][` util .convertProcessSignalToExitCode ()` ].
1682+
16741683### ` subprocess .kill ([signal])`
16751684
16761685<!-- YAML
@@ -2107,6 +2116,10 @@ connection to the child.
21072116The `subprocess.signalCode` property indicates the signal received by
21082117the child process if any, else `null`.
21092118
2119+ When the child process is terminated by a signal, [`subprocess.exitCode`][] will be `null`.
2120+ To get the corresponding POSIX exit code, use
2121+ [`util.convertProcessSignalToExitCode(subprocess.signalCode)`][`util.convertProcessSignalToExitCode()`].
2122+
21102123### `subprocess.spawnargs`
21112124
21122125* Type: {Array}
@@ -2387,12 +2400,15 @@ or [`child_process.fork()`][].
23872400[`stdio`]: #optionsstdio
23882401[`subprocess.connected`]: #subprocessconnected
23892402[`subprocess.disconnect()`]: #subprocessdisconnect
2403+ [`subprocess.exitCode`]: #subprocessexitcode
23902404[`subprocess.kill()`]: #subprocesskillsignal
23912405[`subprocess.send()`]: #subprocesssendmessage-sendhandle-options-callback
2406+ [`subprocess.signalCode`]: #subprocesssignalcode
23922407[`subprocess.stderr`]: #subprocessstderr
23932408[`subprocess.stdin`]: #subprocessstdin
23942409[`subprocess.stdio`]: #subprocessstdio
23952410[`subprocess.stdout`]: #subprocessstdout
2411+ [`util.convertProcessSignalToExitCode()`]: util.md#utilconvertprocesssignaltoexitcodesignalcode
23962412[`util.promisify()`]: util.md#utilpromisifyoriginal
23972413[synchronous counterparts]: #synchronous-process-creation
23982414[v8.serdes]: v8.md#serialization-api
0 commit comments