|
@ -340,22 +340,31 @@ API. |
|
|
The 'stdio' option to `child_process.spawn()` is an array where each |
|
|
The 'stdio' option to `child_process.spawn()` is an array where each |
|
|
index corresponds to a fd in the child. The value is one of the following: |
|
|
index corresponds to a fd in the child. The value is one of the following: |
|
|
|
|
|
|
|
|
1. `null`, `undefined` - Use default value. For 0,1,2 stdios this is the same |
|
|
1. `'pipe'` - Create a pipe between the child process and the parent process. |
|
|
as `'pipe'`. For any higher value, `'ignore'` |
|
|
The parent end of the pipe is exposed to the parent as a property on the |
|
|
2. `'ignore'` - Open the fd in the child, but do not expose it to the parent |
|
|
child_process object as `ChildProcess.stdio[fd]`. Pipes created for |
|
|
3. `'pipe'` - Open the fd and expose as a `Stream` object to parent. |
|
|
fds 0 - 2 are also available as ChildProcess.stdin, ChildProcess.stdout |
|
|
4. `'ipc'` - Create IPC channel for passing messages/file descriptors between |
|
|
and ChildProcess.stderr, respectively. |
|
|
parent and child. |
|
|
2. `'ipc'` - Create an IPC channel for passing messages/file descriptors |
|
|
|
|
|
between parent and child. A ChildProcess may have at most *one* IPC stdio |
|
|
Note: A ChildProcess may have at most *one* IPC stdio file descriptor. |
|
|
file descriptor. Setting this option enables the ChildProcess.send() method. |
|
|
Setting this option enables the ChildProcess.send() method. If the |
|
|
If the child writes JSON messages to this file descriptor, then this will |
|
|
child writes JSON messages to this file descriptor, then this will trigger |
|
|
trigger ChildProcess.on('message'). If the child is a Node.js program, then |
|
|
ChildProcess.on('message'). If the child is a Node.js program, then |
|
|
|
|
|
the presence of an IPC channel will enable process.send() and |
|
|
the presence of an IPC channel will enable process.send() and |
|
|
process.on('message') |
|
|
process.on('message'). |
|
|
5. positive integer - Share corresponding fd with child |
|
|
3. `'ignore'` - Do not set this file descriptor in the child. Note that Node |
|
|
6. Any TTY, TCP, File stream (or any object with `fd` property) - Share |
|
|
will always open fd 0 - 2 for the processes it spawns. When any of these is |
|
|
corresponding stream with child. |
|
|
ignored node will open `/dev/null` and attach it to the child's fd. |
|
|
|
|
|
4. `Stream` object - Share a readable or writable stream that refers to a tty, |
|
|
|
|
|
file, socket, or a pipe with the child process. The stream's underlying |
|
|
|
|
|
file descriptor is duplicated in the child process to the fd that |
|
|
|
|
|
corresponds to the index in the `stdio` array. |
|
|
|
|
|
5. Positive integer - The integer value is interpreted as a file descriptor |
|
|
|
|
|
that is is currently open in the parent process. It is shared with the child |
|
|
|
|
|
process, similar to how `Stream` objects can be shared. |
|
|
|
|
|
6. `null`, `undefined` - Use default value. For stdio fds 0, 1 and 2 (in other |
|
|
|
|
|
words, stdin, stdout, and stderr) a pipe is created. For fd 3 and up, the |
|
|
|
|
|
default is `'ignore'`. |
|
|
|
|
|
|
|
|
As a shorthand, the `stdio` argument may also be one of the following |
|
|
As a shorthand, the `stdio` argument may also be one of the following |
|
|
strings, rather than an array: |
|
|
strings, rather than an array: |
|
|