doc: clarify child_process close event

clarify the 'close' event description in the child_process docs.

fixes: https://github.com/nodejs/node/issues/37998

PR-URL: https://github.com/nodejs/node/pull/38181
Fixes: https://github.com/nodejs/node/issues/37998
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Nitzan Uziely
2021-04-10 03:25:59 +03:00
committed by James M Snell
parent eee2c331ef
commit 474fbb5f6e

View File

@@ -1065,9 +1065,11 @@ added: v0.7.7
* `code` {number} The exit code if the child exited on its own.
* `signal` {string} The signal by which the child process was terminated.
The `'close'` event is emitted when the stdio streams of a child process have
been closed. This is distinct from the [`'exit'`][] event, since multiple
processes might share the same stdio streams.
The `'close'` event is emitted after a process has ended _and_ the stdio
streams of a child process have been closed. This is distinct from the
[`'exit'`][] event, since multiple processes might share the same stdio
streams. The `'close'` event will always emit after [`'exit'`][] was
already emitted, or [`'error'`][] if the child failed to spawn.
```js
const { spawn } = require('child_process');