From 22d39d3a8e8b18dd54e4f3b35812469a7989925c Mon Sep 17 00:00:00 2001 From: Nitzan Uziely Date: Sat, 10 Apr 2021 03:25:59 +0300 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/api/child_process.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index ff8a0b7da8d358..a78ba0e016e29e 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -991,9 +991,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');