@@ -608,9 +608,8 @@ pipes between the parent and child. The value is one of the following:
608608 between parent and child. A [ ` ChildProcess ` ] [ ] may have at most * one* IPC stdio
609609 file descriptor. Setting this option enables the [ ` subprocess.send() ` ] [ ]
610610 method. If the child is a Node.js process, the presence of an IPC channel
611- will enable [ ` process.send() ` ] [ ] , [ ` process.disconnect() ` ] [ ] ,
612- [ ` process.on('disconnect') ` ] [ ] , and [ ` process.on('message') ` ] within the
613- child.
611+ will enable [ ` process.send() ` ] [ ] and [ ` process.disconnect() ` ] [ ] methods,
612+ as well as [ ` 'disconnect' ` ] [ ] and [ ` 'message' ` ] [ ] events within the child.
614613
615614 Accessing the IPC channel fd in any way other than [ ` process.send() ` ] [ ]
616615 or using the IPC channel with a child process that is not a Node.js instance
@@ -651,8 +650,8 @@ spawn('prg', [], { stdio: ['pipe', null, null, null, 'pipe'] });
651650* It is worth noting that when an IPC channel is established between the
652651parent and child processes, and the child is a Node.js process, the child
653652is launched with the IPC channel unreferenced (using ` unref() ` ) until the
654- child registers an event handler for the [ ` process.on( 'disconnect') ` ] [ ] event
655- or the [ ` process.on( 'message') ` ] [ ] event. This allows the child to exit
653+ child registers an event handler for the [ ` 'disconnect' ` ] [ ] event
654+ or the [ ` 'message' ` ] [ ] event. This allows the child to exit
656655normally without the process being held open by the open IPC channel.*
657656
658657See also: [ ` child_process.exec() ` ] [ ] and [ ` child_process.fork() ` ] [ ]
@@ -1103,8 +1102,7 @@ changes:
11031102When an IPC channel has been established between the parent and child (
11041103i.e. when using [ ` child_process.fork() ` ] [ ] ), the ` subprocess.send() ` method can
11051104be used to send messages to the child process. When the child process is a
1106- Node.js instance, these messages can be received via the
1107- [ ` process.on('message') ` ] [ ] event.
1105+ Node.js instance, these messages can be received via the [ ` 'message' ` ] [ ] event.
11081106
11091107The message goes through serialization and parsing. The resulting
11101108message might not be the same as what is originally sent.
@@ -1139,16 +1137,16 @@ allows the child to send messages back to the parent.
11391137
11401138There is a special case when sending a ` {cmd: 'NODE_foo'} ` message. Messages
11411139containing a ` NODE_ ` prefix in the ` cmd ` property are reserved for use within
1142- Node.js core and will not be emitted in the child's [ ` process.on( 'message') ` ] [ ]
1140+ Node.js core and will not be emitted in the child's [ ` 'message' ` ] [ ]
11431141event. Rather, such messages are emitted using the
1144- ` process.on( 'internalMessage') ` event and are consumed internally by Node.js.
1142+ ` 'internalMessage' ` event and are consumed internally by Node.js.
11451143Applications should avoid using such messages or listening for
11461144` 'internalMessage' ` events as it is subject to change without notice.
11471145
11481146The optional ` sendHandle ` argument that may be passed to ` subprocess.send() ` is
11491147for passing a TCP server or socket object to the child process. The child will
11501148receive the object as the second argument passed to the callback function
1151- registered on the [ ` process.on( 'message') ` ] [ ] event. Any data that is received
1149+ registered on the [ ` 'message' ` ] [ ] event. Any data that is received
11521150and buffered in the socket will not be sent to the child.
11531151
11541152The optional ` callback ` is a function that is invoked after the message is
@@ -1363,8 +1361,10 @@ the same requirement. Thus, in `child_process` functions where a shell can be
13631361spawned, ` 'cmd.exe' ` is used as a fallback if ` process.env.ComSpec ` is
13641362unavailable.
13651363
1364+ [ `'disconnect'` ] : process.html#process_event_disconnect
13661365[ `'error'` ] : #child_process_event_error
13671366[ `'exit'` ] : #child_process_event_exit
1367+ [ `'message'` ] : process.html#process_event_message
13681368[ `ChildProcess` ] : #child_process_child_process
13691369[ `Error` ] : errors.html#errors_class_error
13701370[ `EventEmitter` ] : events.html#events_class_eventemitter
@@ -1389,8 +1389,6 @@ unavailable.
13891389[ `process.disconnect()` ] : process.html#process_process_disconnect
13901390[ `process.env` ] : process.html#process_process_env
13911391[ `process.execPath` ] : process.html#process_process_execpath
1392- [ `process.on('disconnect')` ] : process.html#process_event_disconnect
1393- [ `process.on('message')` ] : process.html#process_event_message
13941392[ `process.send()` ] : process.html#process_process_send_message_sendhandle_options_callback
13951393[ `stdio` ] : #child_process_options_stdio
13961394[ `util.promisify()` ] : util.html#util_util_promisify_original
0 commit comments