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