Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document that 'ipc' is required with fork stdio option #8290

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ 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.

When specifying the [`stdio`][] option, the value *must* be a JSON Array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON Array -> array

containing at least one item with value `'ipc'` or a `TypeError` will be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be exactly one 'ipc'? I added test in ae4ce9f that fails if you try to setup multiple IPC channels.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, no 'ipc' == TypeError, too many 'ipc''s == Error. Yay consistency!

thrown. For instance:

```js
const child_process = require('child_process');
child_process.fork('my_script.js', [], {
stdio: [0, 1, 2, 'ipc']
});
```

*Note: Unlike the fork(2) POSIX system call, `child_process.fork()` does
not clone the current process.*

Expand Down