diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-04-09 19:30:22 +0300 |
---|---|---|
committer | Trivikram Kamat <16024985+trivikr@users.noreply.github.com> | 2018-04-11 21:42:38 -0700 |
commit | 9c8857d9461210185e7272a15a1a2f5b75b31faa (patch) | |
tree | 972c2219f2e170a380068f6d2d326e6a25c00f04 /doc/api/child_process.md | |
parent | 7ead832b5a134246e081ca0fe510d061abdd7829 (diff) | |
download | android-node-v8-9c8857d9461210185e7272a15a1a2f5b75b31faa.tar.gz android-node-v8-9c8857d9461210185e7272a15a1a2f5b75b31faa.tar.bz2 android-node-v8-9c8857d9461210185e7272a15a1a2f5b75b31faa.zip |
doc: add quotes for event names + fix similar nits
PR-URL: https://github.com/nodejs/node/pull/19915
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc/api/child_process.md')
-rw-r--r-- | doc/api/child_process.md | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 1ebd3cee19..ecfda860ea 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -608,9 +608,8 @@ pipes between the parent and child. The value is one of the following: 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 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. + will enable [`process.send()`][] and [`process.disconnect()`][] methods, + as well as [`'disconnect'`][] and [`'message'`][] events within the child. Accessing the IPC channel fd in any way other than [`process.send()`][] 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'] }); *It is worth noting that when an IPC channel is established between the parent and child processes, and the child is a Node.js process, the child is launched with the IPC channel unreferenced (using `unref()`) until the -child registers an event handler for the [`process.on('disconnect')`][] event -or the [`process.on('message')`][] event. This allows the child to exit +child registers an event handler for the [`'disconnect'`][] event +or the [`'message'`][] event. This allows the child to exit normally without the process being held open by the open IPC channel.* See also: [`child_process.exec()`][] and [`child_process.fork()`][] @@ -1103,8 +1102,7 @@ changes: When an IPC channel has been established between the parent and child ( i.e. when using [`child_process.fork()`][]), the `subprocess.send()` method can 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. +Node.js instance, these messages can be received via the [`'message'`][] event. The message goes through serialization and parsing. The resulting message might not be the same as what is originally sent. @@ -1139,16 +1137,16 @@ allows the child to send messages back to the parent. There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages containing a `NODE_` prefix in the `cmd` property are reserved for use within -Node.js core and will not be emitted in the child's [`process.on('message')`][] +Node.js core and will not be emitted in the child's [`'message'`][] event. Rather, such messages are emitted using the -`process.on('internalMessage')` event and are consumed internally by Node.js. +`'internalMessage'` event and are consumed internally by Node.js. Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice. 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 [`process.on('message')`][] event. Any data that is received +registered on the [`'message'`][] event. Any data that is received and buffered in the socket will not be sent to the child. The 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 spawned, `'cmd.exe'` is used as a fallback if `process.env.ComSpec` is unavailable. +[`'disconnect'`]: process.html#process_event_disconnect [`'error'`]: #child_process_event_error [`'exit'`]: #child_process_event_exit +[`'message'`]: process.html#process_event_message [`ChildProcess`]: #child_process_child_process [`Error`]: errors.html#errors_class_error [`EventEmitter`]: events.html#events_class_eventemitter @@ -1389,8 +1389,6 @@ unavailable. [`process.disconnect()`]: process.html#process_process_disconnect [`process.env`]: process.html#process_process_env [`process.execPath`]: process.html#process_process_execpath -[`process.on('disconnect')`]: process.html#process_event_disconnect -[`process.on('message')`]: process.html#process_event_message [`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback [`stdio`]: #child_process_options_stdio [`util.promisify()`]: util.html#util_util_promisify_original |