Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e9ee168

Browse filesBrowse files
bzozMylesBorins
authored andcommitted
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: #17460 Fixes: #16491 Fixes: #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>
1 parent 0754734 commit e9ee168
Copy full SHA for e9ee168

File tree

Expand file treeCollapse file tree

2 files changed

+10
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-19
lines changed
Open diff view settings
Collapse file

‎doc/api/child_process.md‎

Copy file name to clipboardExpand all lines: doc/api/child_process.md
+6-12Lines changed: 6 additions & 12 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ By default, `child_process.fork()` will spawn new Node.js instances using the
366366

367367
Node.js processes launched with a custom `execPath` will communicate with the
368368
parent process using the file descriptor (fd) identified using the
369-
environment variable `NODE_CHANNEL_FD` on the child process. The input and
370-
output on this fd is expected to be line delimited JSON objects.
369+
environment variable `NODE_CHANNEL_FD` on the child process.
371370

372371
*Note*: Unlike the fork(2) POSIX system call, `child_process.fork()` does
373372
not clone the current process.
@@ -609,9 +608,7 @@ pipes between the parent and child. The value is one of the following:
609608
2. `'ipc'` - Create an IPC channel for passing messages/file descriptors
610609
between parent and child. A [`ChildProcess`][] may have at most *one* IPC stdio
611610
file descriptor. Setting this option enables the [`subprocess.send()`][]
612-
method. If the child writes JSON messages to this file descriptor, the
613-
[`subprocess.on('message')`][`'message'`] event handler will be triggered in
614-
the parent. If the child is a Node.js process, the presence of an IPC channel
611+
method. If the child is a Node.js process, the presence of an IPC channel
615612
will enable [`process.send()`][], [`process.disconnect()`][],
616613
[`process.on('disconnect')`][], and [`process.on('message')`] within the
617614
child.
@@ -933,9 +930,8 @@ added: v0.5.9
933930
The `'message'` event is triggered when a child process uses [`process.send()`][]
934931
to send messages.
935932

936-
*Note*: The message goes through JSON serialization and parsing. The resulting
937-
message might not be the same as what is originally sent. See notes in
938-
[the `JSON.stringify()` specification][`JSON.stringify` spec].
933+
*Note*: The message goes through serialization and parsing. The resulting
934+
message might not be the same as what is originally sent.
939935

940936
### subprocess.channel
941937
<!-- YAML
@@ -1097,9 +1093,8 @@ be used to send messages to the child process. When the child process is a
10971093
Node.js instance, these messages can be received via the
10981094
[`process.on('message')`][] event.
10991095

1100-
*Note*: The message goes through JSON serialization and parsing. The resulting
1101-
message might not be the same as what is originally sent. See notes in
1102-
[the `JSON.stringify()` specification][`JSON.stringify` spec].
1096+
*Note*: The message goes through serialization and parsing. The resulting
1097+
message might not be the same as what is originally sent.
11031098

11041099
For example, in the parent script:
11051100

@@ -1369,7 +1364,6 @@ unavailable.
13691364
[`ChildProcess`]: #child_process_child_process
13701365
[`Error`]: errors.html#errors_class_error
13711366
[`EventEmitter`]: events.html#events_class_eventemitter
1372-
[`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify
13731367
[`subprocess.connected`]: #child_process_subprocess_connected
13741368
[`subprocess.disconnect()`]: #child_process_subprocess_disconnect
13751369
[`subprocess.kill()`]: #child_process_subprocess_kill_signal
Collapse file

‎doc/api/process.md‎

Copy file name to clipboardExpand all lines: doc/api/process.md
+4-7Lines changed: 4 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ The listener callback is invoked with the following arguments:
9494
* `sendHandle` {Handle object} a [`net.Socket`][] or [`net.Server`][] object, or
9595
undefined.
9696

97-
*Note*: The message goes through JSON serialization and parsing. The resulting
98-
message might not be the same as what is originally sent. See notes in
99-
[the `JSON.stringify()` specification][`JSON.stringify` spec].
97+
*Note*: The message goes through serialization and parsing. The resulting
98+
message might not be the same as what is originally sent.
10099

101100
### Event: 'rejectionHandled'
102101
<!-- YAML
@@ -1519,9 +1518,8 @@ used to send messages to the parent process. Messages will be received as a
15191518
If Node.js was not spawned with an IPC channel, `process.send()` will be
15201519
`undefined`.
15211520

1522-
*Note*: The message goes through JSON serialization and parsing. The resulting
1523-
message might not be the same as what is originally sent. See notes in
1524-
[the `JSON.stringify()` specification][`JSON.stringify` spec].
1521+
*Note*: The message goes through serialization and parsing. The resulting
1522+
message might not be the same as what is originally sent.
15251523

15261524
## process.setegid(id)
15271525
<!-- YAML
@@ -1951,7 +1949,6 @@ cases:
19511949
[`ChildProcess`]: child_process.html#child_process_class_childprocess
19521950
[`Error`]: errors.html#errors_class_error
19531951
[`EventEmitter`]: events.html#events_class_eventemitter
1954-
[`JSON.stringify` spec]: https://tc39.github.io/ecma262/#sec-json.stringify
19551952
[`console.error()`]: console.html#console_console_error_data_args
19561953
[`console.log()`]: console.html#console_console_log_data_args
19571954
[`domain`]: domain.html

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.