Document all the `child_process` options - fixes #90 (#92)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sam Verschueren · committed by Sindre Sorhus · parent 2cbcc5c · Browse files · 1 file·+82 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+82 added−10 removed
- other:+82 added−10 removed
Provenance
- Commit
b82905c- Tree
90e9981- Author
Sam Verschueren <sam.verschueren@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
2cbcc5c
1 file changed+82 added−10 removed
modified:readme.md+82 added-10 removed
62 unmodified lines63 ### execa(file, [arguments], [options])64 65 Execute a file.66 67-Same options as [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).68-67 Think of this as a mix of `child_process.execFile` and `child_process.spawn`.68 69 Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.70 8 unmodified lines79 ### execa.shell(command, [options])80 81 Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.82 85-Same options as [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).86-83 Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).84 85 The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.86 87 ### execa.sync(file, [arguments], [options])88 89 Execute a file synchronously.90 95-Same options as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), except the default encoding is `utf8` instead of `buffer`.96-91 Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).92 93 This method throws an `Error` if the command fails.94 95 ### execa.shellSync(file, [options])96 97 Execute a command synchronously through the system shell.98 105-Same options as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), except the default encoding is `utf8` instead of `buffer`.106-99 Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).100 101 ### options102 111-Additional options:103+Type: `Object`104 105+#### cwd106+107+Type: `string`<br>108+Default: `process.cwd()`109+110+Current working directory of the child process.111+112+#### env113+114+Type: `Object`<br>115+Default: `process.env`116+117+Environment key-value pairs.118+119+#### argv0120+121+Type: `string`122+123+Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.124+125+#### stdio126+127+Type: `Array` `string`<br>128+Default: `pipe`129+130+Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.131+132+#### detached133+134+Type: `boolean`135+136+Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).137+138+#### uid139+140+Type: `number`141+142+Sets the user identity of the process.143+144+#### gid145+146+Type: `number`147+148+Sets the group identity of the process.149+150+#### shell151+152+Type: `boolean` `string`<br>153+Default: `false`154+155+If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.156+157 #### stripEof158 159 Type: `boolean`<br>160 Default: `true`9 unmodified lines170 If you `$ npm install foo`, you can then `execa('foo')`.171 172 #### input173 130-Type: `string` `Buffer` `ReadableStream`174+Type: `string` `Buffer` `stream.Readable`175 176 Write some input to the `stdin` of your binary.<br>177 Streams are not allowed when using the synchronous methods.178 10 unmodified lines189 Default: `true`190 191 Keep track of the spawned process and `kill` it when the parent process exits.192 193+#### encoding194+195+Type: `string`<br>196+Default: `utf8`197+198+Specify the character encoding used to decode the `stdout` and `stderr` output.199+200+#### timeout201+202+Type: `number`<br>203+Default: `0`204+205+If timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds.206+207+#### maxBuffer208+209+Type: `number`<br>210+Default: `10000000` (10MB)211+212+Largest amount of data in bytes allowed on `stdout` or `stderr`.213+214+#### killSignal215+216+Type: `string` `number`<br>217+Default: `SIGTERM`218+219+Signal value to be used when the spawned process will be killed.220+221 #### stdin222 223 Type: `string` `number` `Stream` `undefined` `null`<br>224 Default: `pipe`41 unmodified lines