Skip to content

Commit

Permalink
doc: improve child_process doc
Browse files Browse the repository at this point in the history
1. Clarify that which types of objects can be sent through process.send
2. Clarify that IPC handle are not supported on win32 platform
  • Loading branch information
theanarkh committed Mar 24, 2024
1 parent 4e9ce7c commit 0bb700e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,8 @@ added: v0.5.9
-->

* `message` {Object} A parsed JSON object or primitive value.
* `sendHandle` {Handle} A [`net.Socket`][] or [`net.Server`][] object, or
undefined.
* `sendHandle` {Handle|undefined} `undefined` or a [`net.Socket`][],
[`net.Server`][], or [`dgram.Socket`][] object.

The `'message'` event is triggered when a child process uses
[`process.send()`][] to send messages.
Expand Down Expand Up @@ -1481,7 +1481,8 @@ changes:
-->

* `message` {Object}
* `sendHandle` {Handle}
* `sendHandle` {Handle|undefined} `undefined`, or a [`net.Socket`][],
[`net.Server`][], or [`dgram.Socket`][] object.
* `options` {Object} The `options` argument, if present, is an object used to
parameterize the sending of certain types of handles. `options` supports
the following properties:
Expand Down Expand Up @@ -1539,7 +1540,8 @@ The optional `sendHandle` argument that may be passed to `subprocess.send()` is
for passing a TCP server or socket object to the child process. The child will
receive the object as the second argument passed to the callback function
registered on the [`'message'`][] event. Any data that is received
and buffered in the socket will not be sent to the child.
and buffered in the socket will not be sent to the child. Sending IPC sockets is
not supported on Windows.

The optional `callback` is a function that is invoked after the message is
sent but before the child may have received it. The function is called with a
Expand Down Expand Up @@ -1872,6 +1874,7 @@ or [`child_process.fork()`][].
[`child_process.fork()`]: #child_processforkmodulepath-args-options
[`child_process.spawn()`]: #child_processspawncommand-args-options
[`child_process.spawnSync()`]: #child_processspawnsynccommand-args-options
[`dgram.Socket`]: dgram.md#class-dgramsocket
[`maxBuffer` and Unicode]: #maxbuffer-and-unicode
[`net.Server`]: net.md#class-netserver
[`net.Socket`]: net.md#class-netsocket
Expand Down

0 comments on commit 0bb700e

Please sign in to comment.