doc: remove IPC channel implementation details
IPC messages are more complicated than a simple pipe passing JSON objects separated by new line. This removes inaccurate notes about implementation from the documentation. PR-URL: https://github.com/nodejs/node/pull/17460 Fixes: https://github.com/nodejs/node/issues/16491 Fixes: https://github.com/nodejs/node/issues/17405 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
f5eb803c8d
commit
e8a1fa6920
@ -366,8 +366,7 @@ By default, `child_process.fork()` will spawn new Node.js instances using the
|
||||
|
||||
Node.js processes launched with a custom `execPath` will communicate with the
|
||||
parent process using the file descriptor (fd) identified using the
|
||||
environment variable `NODE_CHANNEL_FD` on the child process. The input and
|
||||
output on this fd is expected to be line delimited JSON objects.
|
||||
environment variable `NODE_CHANNEL_FD` on the child process.
|
||||
|
||||
*Note*: Unlike the fork(2) POSIX system call, `child_process.fork()` does
|
||||
not clone the current process.
|
||||
@ -609,9 +608,7 @@ pipes between the parent and child. The value is one of the following:
|
||||
2. `'ipc'` - Create an IPC channel for passing messages/file descriptors
|
||||
between parent and child. A [`ChildProcess`][] may have at most *one* IPC stdio
|
||||
file descriptor. Setting this option enables the [`subprocess.send()`][]
|
||||
method. If the child writes JSON messages to this file descriptor, the
|
||||
[`subprocess.on('message')`][`'message'`] event handler will be triggered in
|
||||
the parent. If the child is a Node.js process, the presence of an IPC channel
|
||||
method. If the child is a Node.js process, the presence of an IPC channel
|
||||
will enable [`process.send()`][], [`process.disconnect()`][],
|
||||
[`process.on('disconnect')`][], and [`process.on('message')`] within the
|
||||
child.
|
||||
@ -933,9 +930,8 @@ added: v0.5.9
|
||||
The `'message'` event is triggered when a child process uses [`process.send()`][]
|
||||
to send messages.
|
||||
|
||||
*Note*: The message goes through JSON serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent. See notes in
|
||||
[the `JSON.stringify()` specification][`JSON.stringify` spec].
|
||||
*Note*: The message goes through serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent.
|
||||
|
||||
### subprocess.channel
|
||||
<!-- YAML
|
||||
@ -1097,9 +1093,8 @@ be used to send messages to the child process. When the child process is a
|
||||
Node.js instance, these messages can be received via the
|
||||
[`process.on('message')`][] event.
|
||||
|
||||
*Note*: The message goes through JSON serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent. See notes in
|
||||
[the `JSON.stringify()` specification][`JSON.stringify` spec].
|
||||
*Note*: The message goes through serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent.
|
||||
|
||||
For example, in the parent script:
|
||||
|
||||
@ -1369,7 +1364,6 @@ unavailable.
|
||||
[`ChildProcess`]: #child_process_child_process
|
||||
[`Error`]: errors.html#errors_class_error
|
||||
[`EventEmitter`]: events.html#events_class_eventemitter
|
||||
[`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify
|
||||
[`subprocess.connected`]: #child_process_subprocess_connected
|
||||
[`subprocess.disconnect()`]: #child_process_subprocess_disconnect
|
||||
[`subprocess.kill()`]: #child_process_subprocess_kill_signal
|
||||
|
@ -94,9 +94,8 @@ The listener callback is invoked with the following arguments:
|
||||
* `sendHandle` {Handle object} a [`net.Socket`][] or [`net.Server`][] object, or
|
||||
undefined.
|
||||
|
||||
*Note*: The message goes through JSON serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent. See notes in
|
||||
[the `JSON.stringify()` specification][`JSON.stringify` spec].
|
||||
*Note*: The message goes through serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent.
|
||||
|
||||
### Event: 'rejectionHandled'
|
||||
<!-- YAML
|
||||
@ -1519,9 +1518,8 @@ used to send messages to the parent process. Messages will be received as a
|
||||
If Node.js was not spawned with an IPC channel, `process.send()` will be
|
||||
`undefined`.
|
||||
|
||||
*Note*: The message goes through JSON serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent. See notes in
|
||||
[the `JSON.stringify()` specification][`JSON.stringify` spec].
|
||||
*Note*: The message goes through serialization and parsing. The resulting
|
||||
message might not be the same as what is originally sent.
|
||||
|
||||
## process.setegid(id)
|
||||
<!-- YAML
|
||||
@ -1951,7 +1949,6 @@ cases:
|
||||
[`ChildProcess`]: child_process.html#child_process_class_childprocess
|
||||
[`Error`]: errors.html#errors_class_error
|
||||
[`EventEmitter`]: events.html#events_class_eventemitter
|
||||
[`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify
|
||||
[`console.error()`]: console.html#console_console_error_data_args
|
||||
[`console.log()`]: console.html#console_console_log_data_args
|
||||
[`domain`]: domain.html
|
||||
|
Loading…
x
Reference in New Issue
Block a user