From e9ee168a3d7aec32a2648f2934c371cef15c7e40 Mon Sep 17 00:00:00 2001 From: Bartosz Sosnowski Date: Mon, 4 Dec 2017 18:12:59 +0100 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/api/child_process.md | 18 ++++++------------ doc/api/process.md | 11 ++++------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 801c4251942e66..6394fb693475f5 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -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