@ -127,6 +127,10 @@ exec('"my script.cmd" a b', (err, stdout, stderr) => {
### child_process.exec(command[, options][, callback])
### child_process.exec(command[, options][, callback])
<!-- YAML
<!-- YAML
added: v0.1.90
added: v0.1.90
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
-->
-->
* `command` {string} The command to run, with space-separated arguments.
* `command` {string} The command to run, with space-separated arguments.
@ -145,6 +149,8 @@ added: v0.1.90
* `killSignal` {string|integer} * *Default:** `'SIGTERM'`
* `killSignal` {string|integer} * *Default:** `'SIGTERM'`
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* `callback` {Function} called with the output when process terminates.
* `callback` {Function} called with the output when process terminates.
* `error` {Error}
* `error` {Error}
* `stdout` {string|Buffer}
* `stdout` {string|Buffer}
@ -238,6 +244,10 @@ lsExample();
### child_process.execFile(file[, args][, options][, callback])
### child_process.execFile(file[, args][, options][, callback])
<!-- YAML
<!-- YAML
added: v0.1.91
added: v0.1.91
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
-->
-->
* `file` {string} The name or path of the executable file to run.
* `file` {string} The name or path of the executable file to run.
@ -253,6 +263,8 @@ added: v0.1.91
* `killSignal` {string|integer} * *Default:** `'SIGTERM'`
* `killSignal` {string|integer} * *Default:** `'SIGTERM'`
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `uid` {number} Sets the user identity of the process (see setuid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `gid` {number} Sets the group identity of the process (see setgid(2)).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* `callback` {Function} Called with the output when process terminates.
* `callback` {Function} Called with the output when process terminates.
* `error` {Error}
* `error` {Error}
* `stdout` {string|Buffer}
* `stdout` {string|Buffer}
@ -364,6 +376,9 @@ supported by `child_process.fork()` and will be ignored if set.
<!-- YAML
<!-- YAML
added: v0.1.90
added: v0.1.90
changes:
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
- version: v6.4.0
- version: v6.4.0
pr-url: https://github.com/nodejs/node/pull/7696
pr-url: https://github.com/nodejs/node/pull/7696
description: The `argv0` option is supported now.
description: The `argv0` option is supported now.
@ -390,6 +405,8 @@ changes:
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
shell can be specified as a string. See [Shell Requirements][] and
shell can be specified as a string. See [Shell Requirements][] and
[Default Windows Shell][]. **Default:** `false` (no shell).
[Default Windows Shell][]. **Default:** `false` (no shell).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* Returns: {ChildProcess}
* Returns: {ChildProcess}
The `child_process.spawn()` method spawns a new process using the given
The `child_process.spawn()` method spawns a new process using the given
@ -649,6 +666,9 @@ configuration at startup.
<!-- YAML
<!-- YAML
added: v0.11.12
added: v0.11.12
changes:
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
- version: v8.0.0
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/10653
pr-url: https://github.com/nodejs/node/pull/10653
description: The `input` option can now be a `Uint8Array` .
description: The `input` option can now be a `Uint8Array` .
@ -678,6 +698,8 @@ changes:
stderr. **Default:** `200*1024` If exceeded, the child process is terminated.
stderr. **Default:** `200*1024` If exceeded, the child process is terminated.
See caveat at [`maxBuffer` and Unicode][].
See caveat at [`maxBuffer` and Unicode][].
* `encoding` {string} The encoding used for all stdio inputs and outputs. * *Default:** `'buffer'`
* `encoding` {string} The encoding used for all stdio inputs and outputs. * *Default:** `'buffer'`
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* Returns: {Buffer|string} The stdout from the command.
* Returns: {Buffer|string} The stdout from the command.
The `child_process.execFileSync()` method is generally identical to
The `child_process.execFileSync()` method is generally identical to
@ -698,6 +720,9 @@ throw an [`Error`][] that will include the full result of the underlying
<!-- YAML
<!-- YAML
added: v0.11.12
added: v0.11.12
changes:
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
- version: v8.0.0
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/10653
pr-url: https://github.com/nodejs/node/pull/10653
description: The `input` option can now be a `Uint8Array` .
description: The `input` option can now be a `Uint8Array` .
@ -727,6 +752,8 @@ changes:
See caveat at [`maxBuffer` and Unicode][].
See caveat at [`maxBuffer` and Unicode][].
* `encoding` {string} The encoding used for all stdio inputs and outputs.
* `encoding` {string} The encoding used for all stdio inputs and outputs.
**Default:** `'buffer'`
**Default:** `'buffer'`
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* Returns: {Buffer|string} The stdout from the command.
* Returns: {Buffer|string} The stdout from the command.
The `child_process.execSync()` method is generally identical to
The `child_process.execSync()` method is generally identical to
@ -749,6 +776,9 @@ execution.
<!-- YAML
<!-- YAML
added: v0.11.12
added: v0.11.12
changes:
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/15380
description: The `windowsHide` option is supported now.
- version: v8.0.0
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/10653
pr-url: https://github.com/nodejs/node/pull/10653
description: The `input` option can now be a `Uint8Array` .
description: The `input` option can now be a `Uint8Array` .
@ -784,6 +814,8 @@ changes:
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
`'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different
shell can be specified as a string. See [Shell Requirements][] and
shell can be specified as a string. See [Shell Requirements][] and
[Default Windows Shell][]. **Default:** `false` (no shell).
[Default Windows Shell][]. **Default:** `false` (no shell).
* `windowsHide` {boolean} Hide the subprocess console window that would
normally be created on Windows systems. **Default:** `false` .
* Returns: {Object}
* Returns: {Object}
* `pid` {number} Pid of the child process.
* `pid` {number} Pid of the child process.
* `output` {Array} Array of results from stdio output.
* `output` {Array} Array of results from stdio output.