@@ -280,9 +280,9 @@ exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
280280});
281281```
282282
283- If ` timeout ` is greater than ` 0 ` , the parent will send the signal
283+ If ` timeout ` is greater than ` 0 ` , the parent process will send the signal
284284identified by the ` killSignal ` property (the default is ` 'SIGTERM' ` ) if the
285- child runs longer than ` timeout ` milliseconds.
285+ child process runs longer than ` timeout ` milliseconds.
286286
287287Unlike the exec(3) POSIX system call, ` child_process.exec() ` does not replace
288288the existing process and uses a shell to execute the command.
@@ -535,8 +535,8 @@ changes:
535535* ` args ` {string\[ ] } List of string arguments.
536536* ` options ` {Object}
537537 * ` cwd ` {string|URL} Current working directory of the child process.
538- * ` detached ` {boolean} Prepare child to run independently of its parent
539- process. Specific behavior depends on the platform, see
538+ * ` detached ` {boolean} Prepare child process to run independently of its
539+ parent process. Specific behavior depends on the platform, see
540540 [ ` options.detached ` ] [ ] ).
541541 * ` env ` {Object} Environment key-value pairs. ** Default:** ` process.env ` .
542542 * ` execPath ` {string} Executable used to create the child process.
@@ -550,10 +550,11 @@ changes:
550550 AbortSignal.
551551 * ` killSignal ` {string|integer} The signal value to be used when the spawned
552552 process will be killed by timeout or abort signal. ** Default:** ` 'SIGTERM' ` .
553- * ` silent ` {boolean} If ` true ` , stdin, stdout, and stderr of the child will be
554- piped to the parent, otherwise they will be inherited from the parent, see
555- the ` 'pipe' ` and ` 'inherit' ` options for [ ` child_process.spawn() ` ] [ ] 's
556- [ ` stdio ` ] [ ] for more details. ** Default:** ` false ` .
553+ * ` silent ` {boolean} If ` true ` , stdin, stdout, and stderr of the child
554+ process will be piped to the parent process, otherwise they will be inherited
555+ from the parent process, see the ` 'pipe' ` and ` 'inherit' ` options for
556+ [ ` child_process.spawn() ` ] [ ] 's [ ` stdio ` ] [ ] for more details.
557+ ** Default:** ` false ` .
557558 * ` stdio ` {Array|string} See [ ` child_process.spawn() ` ] [ ] 's [ ` stdio ` ] [ ] .
558559 When this option is provided, it overrides ` silent ` . If the array variant
559560 is used, it must contain exactly one item with value ` 'ipc' ` or an error
@@ -686,8 +687,8 @@ changes:
686687 process. This will be set to ` command` if not specified.
687688 * ` stdio` {Array|string} Child's stdio configuration (see
688689 [` options .stdio ` ][` stdio` ]).
689- * ` detached` {boolean} Prepare child to run independently of its parent
690- process. Specific behavior depends on the platform, see
690+ * ` detached` {boolean} Prepare child process to run independently of
691+ its parent process. Specific behavior depends on the platform, see
691692 [` options .detached ` ][]).
692693 * ` uid` {number} Sets the user identity of the process (see setuid(2)).
693694 * ` gid` {number} Sets the group identity of the process (see setgid(2)).
@@ -909,27 +910,27 @@ added: v0.7.10
909910-->
910911
911912On Windows, setting ` options .detached ` to ` true ` makes it possible for the
912- child process to continue running after the parent exits. The child will have
913- its own console window. Once enabled for a child process, it cannot be
914- disabled.
913+ child process to continue running after the parent exits. The child process
914+ will have its own console window. Once enabled for a child process,
915+ it cannot be disabled.
915916
916917On non-Windows platforms, if ` options .detached ` is set to ` true ` , the child
917918process will be made the leader of a new process group and session. Child
918919processes may continue running after the parent exits regardless of whether
919920they are detached or not. See setsid(2) for more information.
920921
921- By default, the parent will wait for the detached child to exit. To prevent the
922- parent from waiting for a given ` subprocess` to exit, use the
923- ` subprocess .unref ()` method. Doing so will cause the parent's event loop to not
924- include the child in its reference count, allowing the parent to exit
925- independently of the child, unless there is an established IPC channel between
926- the child and the parent.
922+ By default, the parent will wait for the detached child process to exit.
923+ To prevent the parent process from waiting for a given ` subprocess` to exit, use
924+ the ` subprocess .unref ()` method. Doing so will cause the parent process' event
925+ loop to not include the child process in its reference count, allowing the
926+ parent process to exit independently of the child process , unless there is an established
927+ IPC channel between the child and the parent processes .
927928
928929When using the ` detached` option to start a long-running process, the process
929930will not stay running in the background after the parent exits unless it is
930931provided with a ` stdio` configuration that is not connected to the parent.
931- If the parent's ` stdio` is inherited, the child will remain attached to the
932- controlling terminal.
932+ If the parent process' ` stdio` is inherited, the child process will remain attached
933+ to the controlling terminal.
933934
934935Example of a long-running process, by detaching and also ignoring its parent
935936` stdio` file descriptors, in order to ignore the parent's termination:
@@ -1039,10 +1040,10 @@ pipes between the parent and child. The value is one of the following:
103910403. ` ' ipc' ` : Create an IPC channel for passing messages/file descriptors
10401041 between parent and child. A [` ChildProcess` ][] may have at most one IPC
10411042 stdio file descriptor. Setting this option enables the
1042- [` subprocess .send ()` ][] method. If the child is a Node.js process, the
1043- presence of an IPC channel will enable [` process .send ()` ][] and
1043+ [` subprocess .send ()` ][] method. If the child process is a Node.js instance,
1044+ the presence of an IPC channel will enable [` process .send ()` ][] and
10441045 [` process .disconnect ()` ][] methods, as well as [` ' disconnect' ` ][] and
1045- [` ' message' ` ][] events within the child.
1046+ [` ' message' ` ][] events within the child process .
10461047
10471048 Accessing the IPC channel fd in any way other than [` process .send ()` ][]
10481049 or using the IPC channel with a child process that is not a Node.js instance
@@ -1109,12 +1110,12 @@ spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
11091110` ` `
11101111
11111112_It is worth noting that when an IPC channel is established between the
1112- parent and child processes, and the child is a Node.js process, the child
1113- is launched with the IPC channel unreferenced (using ` unref () ` ) until the
1114- child registers an event handler for the [ ` ' disconnect ' ` ][] event
1115- or the [` ' message' ` ][] event. This allows the child to exit
1116- normally without the process being held open by the open IPC channel._
1117-
1113+ parent and child processes, and the child process is a Node.js instance,
1114+ the child process is launched with the IPC channel unreferenced (using
1115+ ` unref () ` ) until the child process registers an event handler for the
1116+ [ ` ' disconnect ' ` ][] event or the [` ' message' ` ][] event. This allows the
1117+ child process to exit normally without the process being held open by the
1118+ open IPC channel._
11181119See also: [` child_process .exec ()` ][] and [` child_process .fork ()` ][].
11191120
11201121## Synchronous process creation
@@ -1437,14 +1438,14 @@ instances of `ChildProcess`.
14371438added: v0.7.7
14381439-->
14391440
1440- * ` code` {number} The exit code if the child exited on its own.
1441+ * ` code` {number} The exit code if the child process exited on its own.
14411442* ` signal` {string} The signal by which the child process was terminated.
14421443
14431444The ` ' close' ` event is emitted after a process has ended _and_ the stdio
14441445streams of a child process have been closed. This is distinct from the
14451446[` ' exit' ` ][] event, since multiple processes might share the same stdio
14461447streams. The ` ' close' ` event will always emit after [` ' exit' ` ][] was
1447- already emitted, or [` ' error' ` ][] if the child failed to spawn.
1448+ already emitted, or [` ' error' ` ][] if the child process failed to spawn.
14481449
14491450` ` ` cjs
14501451const { spawn } = require (' node:child_process' );
@@ -1515,7 +1516,7 @@ See also [`subprocess.kill()`][] and [`subprocess.send()`][].
15151516added: v0.1.90
15161517-->
15171518
1518- * ` code` {number} The exit code if the child exited on its own.
1519+ * ` code` {number} The exit code if the child process exited on its own.
15191520* ` signal` {string} The signal by which the child process was terminated.
15201521
15211522The ` ' exit' ` event is emitted after the child process ends. If the process
@@ -1625,11 +1626,12 @@ send and receive messages from a child process. When `subprocess.connected` is
16251626added: v0.7.2
16261627-->
16271628
1628- Closes the IPC channel between parent and child, allowing the child to exit
1629- gracefully once there are no other connections keeping it alive. After calling
1630- this method the ` subprocess .connected ` and ` process .connected ` properties in
1631- both the parent and child (respectively) will be set to ` false ` , and it will be
1632- no longer possible to pass messages between the processes.
1629+ Closes the IPC channel between parent and child processes, allowing the child
1630+ process to exit gracefully once there are no other connections keeping it alive.
1631+ After calling this method the ` subprocess .connected ` and
1632+ ` process .connected ` properties in both the parent and child processes
1633+ (respectively) will be set to ` false ` , and it will be no longer possible
1634+ to pass messages between the processes.
16331635
16341636The ` ' disconnect' ` event will be emitted when there are no messages in the
16351637process of being received. This will most often be triggered immediately after
@@ -1807,7 +1809,7 @@ added: v0.7.10
18071809
18081810Calling ` subprocess .ref ()` after making a call to ` subprocess .unref ()` will
18091811restore the removed reference count for the child process, forcing the parent
1810- to wait for the child to exit before exiting itself.
1812+ process to wait for the child process to exit before exiting itself.
18111813
18121814` ` ` cjs
18131815const { spawn } = require (' node:child_process' );
@@ -1864,9 +1866,9 @@ changes:
18641866* ` callback` {Function}
18651867* Returns: {boolean}
18661868
1867- When an IPC channel has been established between the parent and child (
1868- i.e. when using [` child_process .fork ()` ][]), the ` subprocess .send ()` method can
1869- be used to send messages to the child process. When the child process is a
1869+ When an IPC channel has been established between the parent and child processes
1870+ ( i.e. when using [` child_process .fork ()` ][]), the ` subprocess .send ()` method
1871+ can be used to send messages to the child process. When the child process is a
18701872Node.js instance, these messages can be received via the [` ' message' ` ][] event.
18711873
18721874The message goes through serialization and parsing. The resulting
@@ -1910,7 +1912,7 @@ process.send({ foo: 'bar', baz: NaN });
19101912` ` `
19111913
19121914Child Node .js processes will have a [` process.send()` ][] method of their own
1913- that allows the child to send messages back to the parent.
1915+ that allows the child process to send messages back to the parent process .
19141916
19151917There is a special case when sending a ` {cmd: 'NODE_foo'}` message . Messages
19161918containing a ` NODE_` prefix in the ` cmd` property are reserved for use within
@@ -1921,14 +1923,14 @@ Applications should avoid using such messages or listening for
19211923`' internalMessage' ` events as it is subject to change without notice.
19221924
19231925The optional `sendHandle` argument that may be passed to `subprocess.send()` is
1924- for passing a TCP server or socket object to the child process. The child will
1926+ for passing a TCP server or socket object to the child process. The child process will
19251927receive the object as the second argument passed to the callback function
19261928registered on the [`' message' `][] event. Any data that is received
19271929and buffered in the socket will not be sent to the child. Sending IPC sockets is
19281930not supported on Windows.
19291931
19301932The optional `callback` is a function that is invoked after the message is
1931- sent but before the child may have received it. The function is called with a
1933+ sent but before the child process may have received it. The function is called with a
19321934single argument: `null` on success, or an [`Error`][] object on failure.
19331935
19341936If no `callback` function is provided and the message cannot be sent, an
@@ -1977,7 +1979,7 @@ server.listen(1337, () => {
19771979});
19781980```
19791981
1980- The child would then receive the server object as:
1982+ The child process would then receive the server object as:
19811983
19821984```js
19831985process.on(' message' , (m, server) => {
@@ -2111,7 +2113,7 @@ added: v0.1.90
21112113
21122114A `Readable Stream` that represents the child process' s ` stderr` .
21132115
2114- If the child was spawned with ` stdio[2]` set to anything other than ` 'pipe'` ,
2116+ If the child process was spawned with ` stdio[2]` set to anything other than ` 'pipe'` ,
21152117then this will be ` null` .
21162118
21172119` subprocess.stderr` is an alias for ` subprocess.stdio[2]` . Both properties will
@@ -2130,10 +2132,10 @@ added: v0.1.90
21302132
21312133A ` Writable Stream` that represents the child process ' s `stdin`.
21322134
2133- If a child process waits to read all of its input, the child will not continue
2135+ If a child process waits to read all of its input, the child process will not continue
21342136until this stream has been closed via `end()`.
21352137
2136- If the child was spawned with `stdio[0]` set to anything other than `' pipe' `,
2138+ If the child process was spawned with `stdio[0]` set to anything other than `' pipe' `,
21372139then this will be `null`.
21382140
21392141`subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
@@ -2219,7 +2221,7 @@ added: v0.1.90
22192221
22202222A ` Readable Stream` that represents the child process ' s `stdout`.
22212223
2222- If the child was spawned with `stdio[1]` set to anything other than `' pipe' `,
2224+ If the child process was spawned with `stdio[1]` set to anything other than `' pipe' `,
22232225then this will be `null`.
22242226
22252227`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
@@ -2254,12 +2256,12 @@ if the child process could not be successfully spawned.
22542256added: v0.7.10
22552257-->
22562258
2257- By default, the parent will wait for the detached child to exit. To prevent the
2258- parent from waiting for a given `subprocess` to exit, use the
2259+ By default, the parent process will wait for the detached child process to exit.
2260+ To prevent the parent process from waiting for a given `subprocess` to exit, use the
22592261`subprocess.unref()` method. Doing so will cause the parent' s event loop to not
2260- include the child in its reference count, allowing the parent to exit
2262+ include the child process in its reference count, allowing the parent to exit
22612263independently of the child, unless there is an established IPC channel between
2262- the child and the parent.
2264+ the child and the parent processes .
22632265
22642266` ` ` cjs
22652267const { spawn } = require('node:child_process');
0 commit comments