From 23569e6a7f8151c102fa1a5846de11b8a045359a Mon Sep 17 00:00:00 2001 From: Nitzan Uziely Date: Sat, 10 Apr 2021 03:25:59 +0300 Subject: [PATCH 1/2] doc: clarify child_process close event clarify the 'close' event description in the child_process docs. fixes: https://github.com/nodejs/node/issues/37998 --- 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 6e1705386b8fc9..cc7d365a793cc4 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -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'); From 8056160696da424c593465b56fd1347a26f04519 Mon Sep 17 00:00:00 2001 From: Nitzan Uziely Date: Sat, 10 Apr 2021 03:43:43 +0300 Subject: [PATCH 2/2] fixup! doc: clarify child_process close event --- doc/api/child_process.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index cc7d365a793cc4..d9cfcde6d9e0b6 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1065,11 +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 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. +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');