Meta tweaks
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sindre Sorhus · committed by Sindre Sorhus · parent 74c3c49 · Browse files · 2 files·+40 added−45 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+40 added−45 removed
- other:+40 added−45 removed
Provenance
- Commit
4093556- Tree
b7d9e2e- Author
Sindre Sorhus <sindresorhus@gmail.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
74c3c49
2 files changed+40 added−45 removed
modified:package.json+3 added-2 removed
2 unmodified lines3456789101141 unmodified lines53545556565758596061626263646566675 unmodified lines2 unmodified lines "version": "3.4.0", "description": "Process execution for humans", "license": "MIT", "repository": "sindresorhus/execa", "funding": "https://github.com/sindresorhus/execa?sponsor=1", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com"41 unmodified lines "devDependencies": { "@types/node": "^12.0.7", "ava": "^2.1.0", "coveralls": "^3.0.4", "get-node": "^5.0.0", "get-node": "^6.6.0", "is-running": "^2.1.0", "nyc": "^14.1.1", "p-event": "^4.1.0", "tempfile": "^3.0.0", "tsd": "^0.7.3", "xo": "^0.24.0" "xo": "^0.25.3" }, "nyc": { "exclude": [ "**/fixtures/**",5 unmodified linesmodified:readme.md+37 added-43 removed
3 unmodified lines4 [](https://travis-ci.org/sindresorhus/execa) [](https://coveralls.io/github/sindresorhus/execa?branch=master)5 6 > Process execution for humans7 8-8 ## Why9 10 This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with:11 7 unmodified lines19 - [Get interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal. [*(Async only)*](#execasyncfile-arguments-options)20 - [Can specify file and arguments as a single string without a shell](#execacommandcommand-options)21 - More descriptive errors.22 24-23 ## Install24 25 ```26 $ npm install execa27 ```28 31-29 ## Usage30 31 ```js32 const execa = require('execa');111 unmodified lines144 });145 }, 1000);146 ```147 151-148 ## API149 154-### execa(file, arguments, [options])150+### execa(file, arguments, options?)151 152 Execute a file. Think of this as a mix of [`child_process.execFile()`](https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback) and [`child_process.spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).153 154 No escaping/quoting is needed.3 unmodified lines158 Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) which:159 - is also a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).160 - exposes the following additional methods and properties.161 166-#### kill([signal], [options])162+#### kill(signal?, options?)163 164 Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal) except: if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`.165 166 ##### options.forceKillAfterTimeout167 172-Type: `number | false`<br>168+Type: `number | false`\169 Default: `5000`170 171 Milliseconds to wait for the child process to terminate before sending `SIGKILL`.172 12 unmodified lines185 This is `undefined` if either:186 - the [`all` option](#all-2) is `false` (the default value)187 - both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)188 193-### execa.sync(file, [arguments], [options])189+### execa.sync(file, arguments?, options?)190 191 Execute a file synchronously.192 193 Returns or throws a [`childProcessResult`](#childProcessResult).194 199-### execa.command(command, [options])195+### execa.command(command, options?)196 197 Same as [`execa()`](#execafile-arguments-options) except both file and arguments are specified in a single `command` string. For example, `execa('echo', ['unicorns'])` is the same as `execa.command('echo unicorns')`.198 199 If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if `command` is not a constant but a variable, for example with `__dirname` or `process.cwd()`. Except for spaces, no escaping/quoting is needed.200 201 The [`shell` option](#shell) must be used if the `command` uses shell-specific features, as opposed to being a simple `file` followed by its `arguments`.202 207-### execa.commandSync(command, [options])203+### execa.commandSync(command, options?)204 205 Same as [`execa.command()`](#execacommand-command-options) but synchronous.206 207 Returns or throws a [`childProcessResult`](#childProcessResult).208 213-### execa.node(scriptPath, [arguments], [options])209+### execa.node(scriptPath, arguments?, options?)210 211 Execute a Node.js script as a child process.212 213 Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):101 unmodified lines315 Type: `object`316 317 #### cleanup318 323-Type: `boolean`<br>319+Type: `boolean`\320 Default: `true`321 322 Kill the spawned process when the parent process exits unless either:323 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)324 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit325 326 #### preferLocal327 332-Type: `boolean`<br>328+Type: `boolean`\329 Default: `false`330 335-Prefer locally installed binaries when looking for a binary to execute.<br>331+Prefer locally installed binaries when looking for a binary to execute.\332 If you `$ npm install foo`, you can then `execa('foo')`.333 334 #### localDir335 340-Type: `string`<br>336+Type: `string`\337 Default: `process.cwd()`338 339 Preferred path to find locally installed binaries in (use with `preferLocal`).340 341 #### execPath342 347-Type: `string`<br>348-Default: `process.execPath` (current Node.js executable)343+Type: `string`\344+Default: `process.execPath` (Current Node.js executable)345 346 Path to the Node.js executable to use in child processes.347 348 This can be either an absolute path or a path relative to the [`cwd` option](#cwd).3 unmodified lines352 For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.353 354 #### buffer355 360-Type: `boolean`<br>356+Type: `boolean`\357 Default: `true`358 359 Buffer the output from the spawned process. When set to `false`, you must read the output of [`stdout`](#stdout-1) and [`stderr`](#stderr-1) (or [`all`](#all) if the [`all`](#all-2) option is `true`). Otherwise the returned promise will not be resolved/rejected.360 2 unmodified lines363 #### input364 365 Type: `string | Buffer | stream.Readable`366 371-Write some input to the `stdin` of your binary.<br>367+Write some input to the `stdin` of your binary.\368 Streams are not allowed when using the synchronous methods.369 370 #### stdin371 376-Type: `string | number | Stream | undefined`<br>372+Type: `string | number | Stream | undefined`\373 Default: `pipe`374 375 Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).376 377 #### stdout378 383-Type: `string | number | Stream | undefined`<br>379+Type: `string | number | Stream | undefined`\380 Default: `pipe`381 382 Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).383 384 #### stderr385 390-Type: `string | number | Stream | undefined`<br>386+Type: `string | number | Stream | undefined`\387 Default: `pipe`388 389 Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).390 391 #### all392 397-Type: `boolean`<br>393+Type: `boolean`\394 Default: `false`395 396 Add an `.all` property on the [promise](#all) and the [resolved value](#all-1). The property contains the output of the process with `stdout` and `stderr` interleaved.397 398 #### reject399 404-Type: `boolean`<br>400+Type: `boolean`\401 Default: `true`402 403 Setting this to `false` resolves the promise with the error instead of rejecting it.404 405 #### stripFinalNewline406 411-Type: `boolean`<br>407+Type: `boolean`\408 Default: `true`409 410 Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.411 412 #### extendEnv413 418-Type: `boolean`<br>414+Type: `boolean`\415 Default: `true`416 417 Set to `false` if you don't want to extend the environment variables when providing the `env` property.418 2 unmodified lines421 Execa also accepts the below options which are the same as the options for [`child_process#spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)/[`child_process#exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)422 423 #### cwd424 429-Type: `string`<br>425+Type: `string`\426 Default: `process.cwd()`427 428 Current working directory of the child process.429 430 #### env431 436-Type: `object`<br>432+Type: `object`\433 Default: `process.env`434 435 Environment key-value pairs. Extends automatically from `process.env`. Set [`extendEnv`](#extendenv) to `false` if you don't want this.436 4 unmodified lines441 Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.442 443 #### stdio444 449-Type: `string | string[]`<br>445+Type: `string | string[]`\446 Default: `pipe`447 448 Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.449 450 #### serialization451 456-Type: `string`<br>452+Type: `string`\453 Default: `'json'`454 455 Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio) option or [`execa.node()`](#execanodescriptpath-arguments-options):456 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.22 unmodified lines479 Sets the group identity of the process.480 481 #### shell482 487-Type: `boolean | string`<br>483+Type: `boolean | string`\484 Default: `false`485 486 If `true`, runs `file` 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.487 3 unmodified lines491 - unsafe, potentially allowing command injection.492 493 #### encoding494 499-Type: `string | null`<br>495+Type: `string | null`\496 Default: `utf8`497 498 Specify the character encoding used to decode the `stdout` and `stderr` output. If set to `null`, then `stdout` and `stderr` will be a `Buffer` instead of a string.499 500 #### timeout501 506-Type: `number`<br>502+Type: `number`\503 Default: `0`504 505 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.506 507 #### maxBuffer508 513-Type: `number`<br>509+Type: `number`\510 Default: `100_000_000` (100 MB)511 512 Largest amount of data in bytes allowed on `stdout` or `stderr`.513 514 #### killSignal515 520-Type: `string | number`<br>516+Type: `string | number`\517 Default: `SIGTERM`518 519 Signal value to be used when the spawned process will be killed.520 521 #### windowsVerbatimArguments522 527-Type: `boolean`<br>523+Type: `boolean`\524 Default: `false`525 526 If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.527 528 #### windowsHide529 534-Type: `boolean`<br>530+Type: `boolean`\531 Default: `true`532 533 On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.534 539-#### nodePath *(for `.node()` only)*535+#### nodePath *(For `.node()` only)*536 541-Type: `string`<br>537+Type: `string`\538 Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)539 540 Node.js executable used to create the child process.541 546-#### nodeOptions *(for `.node()` only)*542+#### nodeOptions *(For `.node()` only)*543 548-Type: `string[]`<br>544+Type: `string[]`\545 Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)546 547 List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.548 65 unmodified lines614 615 - [gulp-execa](https://github.com/ehmicky/gulp-execa) - Gulp plugin for `execa`616 - [nvexeca](https://github.com/ehmicky/nvexeca) - Run `execa` using any Node.js version617 622-618 ## Maintainers619 620 - [Sindre Sorhus](https://github.com/sindresorhus)621 - [@ehmicky](https://github.com/ehmicky)622 628-623 ---624 625 <div align="center">626 <b>7 unmodified lines