@@ -1448,15 +1448,22 @@ instances of `ChildProcess`. |
1448 | 1448 | added: v0.7.7 |
1449 | 1449 | --> |
1450 | 1450 |
|
1451 | | -* `code` {number} The exit code if the child process exited on its own. |
1452 | | -* `signal` {string} The signal by which the child process was terminated. |
| 1451 | +* `code` {number} The exit code if the child process exited on its own, or |
| 1452 | + `null` if the child process terminated due to a signal. |
| 1453 | +* `signal` {string} The signal by which the child process was terminated, or |
| 1454 | + `null` if the child process did not terminated due to a signal. |
1453 | 1455 |
|
1454 | 1456 | The `'close'` event is emitted after a process has ended _and_ the stdio |
1455 | 1457 | streams of a child process have been closed. This is distinct from the |
1456 | 1458 | [`'exit'`][] event, since multiple processes might share the same stdio |
1457 | 1459 | streams. The `'close'` event will always emit after [`'exit'`][] was |
1458 | 1460 | already emitted, or [`'error'`][] if the child process failed to spawn. |
1459 | 1461 |
|
| 1462 | +If the process exited, `code` is the final exit code of the process, otherwise |
| 1463 | +`null`. If the process terminated due to receipt of a signal, `signal` is the |
| 1464 | +string name of the signal, otherwise `null`. One of the two will always be |
| 1465 | +non-`null`. |
| 1466 | +
|
1460 | 1467 | ```cjs |
1461 | 1468 | const { spawn } = require('node:child_process'); |
1462 | 1469 | const ls = spawn('ls', ['-lh', '/usr']); |
@@ -1526,8 +1533,10 @@ See also [`subprocess.kill()`][] and [`subprocess.send()`][]. |
1526 | 1533 | added: v0.1.90 |
1527 | 1534 | --> |
1528 | 1535 |
|
1529 | | -* `code` {number} The exit code if the child process exited on its own. |
1530 | | -* `signal` {string} The signal by which the child process was terminated. |
| 1536 | +* `code` {number} The exit code if the child process exited on its own, or |
| 1537 | + `null` if the child process terminated due to a signal. |
| 1538 | +* `signal` {string} The signal by which the child process was terminated, or |
| 1539 | + `null` if the child process did not terminated due to a signal. |
1531 | 1540 |
|
1532 | 1541 | The `'exit'` event is emitted after the child process ends. If the process |
1533 | 1542 | exited, `code` is the final exit code of the process, otherwise `null`. If the |
|