@@ -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
@@ -1805,7 +1807,7 @@ added: v0.7.10
18051807
18061808Calling ` subprocess .ref ()` after making a call to ` subprocess .unref ()` will
18071809restore the removed reference count for the child process, forcing the parent
1808- to wait for the child to exit before exiting itself.
1810+ process to wait for the child process to exit before exiting itself.
18091811
18101812` ` ` cjs
18111813const { spawn } = require (' node:child_process' );
@@ -1862,9 +1864,9 @@ changes:
18621864* ` callback` {Function}
18631865* Returns: {boolean}
18641866
1865- When an IPC channel has been established between the parent and child (
1866- i.e. when using [` child_process .fork ()` ][]), the ` subprocess .send ()` method can
1867- be used to send messages to the child process. When the child process is a
1867+ When an IPC channel has been established between the parent and child processes
1868+ ( i.e. when using [` child_process .fork ()` ][]), the ` subprocess .send ()` method
1869+ can be used to send messages to the child process. When the child process is a
18681870Node.js instance, these messages can be received via the [` ' message' ` ][] event.
18691871
18701872The message goes through serialization and parsing. The resulting
@@ -1908,7 +1910,7 @@ process.send({ foo: 'bar', baz: NaN });
19081910` ` `
19091911
19101912Child Node .js processes will have a [` process.send()` ][] method of their own
1911- that allows the child to send messages back to the parent.
1913+ that allows the child process to send messages back to the parent process .
19121914
19131915There is a special case when sending a ` {cmd: 'NODE_foo'}` message . Messages
19141916containing a ` NODE_` prefix in the ` cmd` property are reserved for use within
@@ -1919,14 +1921,14 @@ Applications should avoid using such messages or listening for
19191921`' internalMessage' ` events as it is subject to change without notice.
19201922
19211923The optional `sendHandle` argument that may be passed to `subprocess.send()` is
1922- for passing a TCP server or socket object to the child process. The child will
1924+ for passing a TCP server or socket object to the child process. The child process will
19231925receive the object as the second argument passed to the callback function
19241926registered on the [`' message' `][] event. Any data that is received
19251927and buffered in the socket will not be sent to the child. Sending IPC sockets is
19261928not supported on Windows.
19271929
19281930The optional `callback` is a function that is invoked after the message is
1929- sent but before the child may have received it. The function is called with a
1931+ sent but before the child process may have received it. The function is called with a
19301932single argument: `null` on success, or an [`Error`][] object on failure.
19311933
19321934If no `callback` function is provided and the message cannot be sent, an
@@ -1975,7 +1977,7 @@ server.listen(1337, () => {
19751977});
19761978```
19771979
1978- The child would then receive the server object as:
1980+ The child process would then receive the server object as:
19791981
19801982```js
19811983process.on(' message' , (m, server) => {
@@ -2109,7 +2111,7 @@ added: v0.1.90
21092111
21102112A `Readable Stream` that represents the child process' s ` stderr` .
21112113
2112- If the child was spawned with ` stdio[2]` set to anything other than ` 'pipe'` ,
2114+ If the child process was spawned with ` stdio[2]` set to anything other than ` 'pipe'` ,
21132115then this will be ` null` .
21142116
21152117` subprocess.stderr` is an alias for ` subprocess.stdio[2]` . Both properties will
@@ -2128,10 +2130,10 @@ added: v0.1.90
21282130
21292131A ` Writable Stream` that represents the child process ' s `stdin`.
21302132
2131- If a child process waits to read all of its input, the child will not continue
2133+ If a child process waits to read all of its input, the child process will not continue
21322134until this stream has been closed via `end()`.
21332135
2134- If the child was spawned with `stdio[0]` set to anything other than `' pipe' `,
2136+ If the child process was spawned with `stdio[0]` set to anything other than `' pipe' `,
21352137then this will be `null`.
21362138
21372139`subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
@@ -2217,7 +2219,7 @@ added: v0.1.90
22172219
22182220A ` Readable Stream` that represents the child process ' s `stdout`.
22192221
2220- If the child was spawned with `stdio[1]` set to anything other than `' pipe' `,
2222+ If the child process was spawned with `stdio[1]` set to anything other than `' pipe' `,
22212223then this will be `null`.
22222224
22232225`subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will
@@ -2252,12 +2254,12 @@ if the child process could not be successfully spawned.
22522254added: v0.7.10
22532255-->
22542256
2255- By default, the parent will wait for the detached child to exit. To prevent the
2256- parent from waiting for a given `subprocess` to exit, use the
2257+ By default, the parent process will wait for the detached child process to exit.
2258+ To prevent the parent process from waiting for a given `subprocess` to exit, use the
22572259`subprocess.unref()` method. Doing so will cause the parent' s event loop to not
2258- include the child in its reference count, allowing the parent to exit
2260+ include the child process in its reference count, allowing the parent to exit
22592261independently of the child, unless there is an established IPC channel between
2260- the child and the parent.
2262+ the child and the parent processes .
22612263
22622264` ` ` cjs
22632265const { spawn } = require('node:child_process');
0 commit comments