|
@ -59,15 +59,19 @@ The third argument is used to specify additional options, which defaults to: |
|
|
|
|
|
|
|
|
{ cwd: undefined, |
|
|
{ cwd: undefined, |
|
|
env: process.env, |
|
|
env: process.env, |
|
|
customFds: [-1, -1, -1], |
|
|
|
|
|
setsid: false |
|
|
setsid: false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
`cwd` allows you to specify the working directory from which the process is spawned. |
|
|
`cwd` allows you to specify the working directory from which the process is spawned. |
|
|
Use `env` to specify environment variables that will be visible to the new process. |
|
|
Use `env` to specify environment variables that will be visible to the new process. |
|
|
With `customFds` it is possible to hook up the new process' [stdin, stdout, stderr] to |
|
|
|
|
|
existing streams; `-1` means that a new stream should be created. `setsid`, |
|
|
There is a deprecated option called `customFds` which allows one to specify |
|
|
if set true, will cause the subprocess to be run in a new session. |
|
|
specific file descriptors for the stdio of the child process. This API is |
|
|
|
|
|
was not portable to all platforms and therefore removed. |
|
|
|
|
|
With `customFds` it was possible to hook up the new process' [stdin, stdout, |
|
|
|
|
|
stderr] to existing streams; `-1` meant that a new stream should be created. |
|
|
|
|
|
|
|
|
|
|
|
`setsid`, if set true, will cause the subprocess to be run in a new session. |
|
|
|
|
|
|
|
|
Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the exit code: |
|
|
Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the exit code: |
|
|
|
|
|
|
|
@ -217,8 +221,7 @@ In the child the `process` object will have a `send()` method, and `process` |
|
|
will emit objects each time it receives a message on its channel. |
|
|
will emit objects each time it receives a message on its channel. |
|
|
|
|
|
|
|
|
By default the spawned Node process will have the stdin, stdout, stderr |
|
|
By default the spawned Node process will have the stdin, stdout, stderr |
|
|
associated with the parent's. This can be overridden by using the |
|
|
associated with the parent's. |
|
|
`customFds` option. |
|
|
|
|
|
|
|
|
|
|
|
These child Nodes are still whole new instances of V8. Assume at least 30ms |
|
|
These child Nodes are still whole new instances of V8. Assume at least 30ms |
|
|
startup and 10mb memory for each new Node. That is, you cannot create many |
|
|
startup and 10mb memory for each new Node. That is, you cannot create many |
|
|