Improve headers in `readme.md` (#967)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent fdffcb6 · Browse files · 4 files·+218 added−218 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+218 added−218 removed
- other:+218 added−218 removed
Provenance
- Commit
a5dcf42- Tree
1989f6c- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
fdffcb6
4 files changed+218 added−218 removed
modified:docs/scripts.md+4 added-4 removed
3 unmodified lines4 - [performant](#performance)5 - [cross-platform](#shell): [no shell](../readme.md#shell-syntax) is used, only JavaScript.6 - [secure](#escaping): no shell injection.7 - [simple](#simplicity): minimalistic API, no [globals](#global-variables), no [binary](#main-binary), no [builtin CLI utilities](#builtin-utilities).8- - [featureful](#simplicity): all Execa features are available ([subprocess piping](#piping-stdout-to-another-command), [IPC](#ipc), [transforms](#transforms), [background subprocesses](#background-subprocesses), [cancellation](#cancellation), [local binaries](#local-binaries), [cleanup on exit](../readme.md#cleanup), [interleaved output](#interleaved-output), [forceful termination](../readme.md#forcekillafterdelay), etc.).8+ - [featureful](#simplicity): all Execa features are available ([subprocess piping](#piping-stdout-to-another-command), [IPC](#ipc), [transforms](#transforms), [background subprocesses](#background-subprocesses), [cancellation](#cancellation), [local binaries](#local-binaries), [cleanup on exit](../readme.md#optionscleanup), [interleaved output](#interleaved-output), [forceful termination](../readme.md#optionsforcekillafterdelay), etc.).9 - [easy to debug](#debugging): [verbose mode](#verbose-mode), [detailed errors](#errors), [messages and stack traces](#cancellation), stateless API.10 11 ```js12 import {$} from 'execa';803 unmodified lines816 This is more cross-platform. For example, your code works the same on Windows machines without Bash installed.817 818 Also, there is no shell syntax to remember: everything is just plain JavaScript.819 820-If you really need a shell though, the [`shell` option](../readme.md#shell) can be used.820+If you really need a shell though, the [`shell`](../readme.md#optionsshell) option can be used.821 822 ### Simplicity823 824 Execa's scripting API mostly consists of only two methods: [`` $`command` ``](../readme.md#file-arguments-options) and [`$(options)`](../readme.md#execaoptions).15 unmodified lines840 Also, [local binaries](#local-binaries) can be directly executed without using `npx`.841 842 ### Debugging843 844-Subprocesses can be hard to debug, which is why Execa includes a [`verbose` option](#verbose-mode).844+Subprocesses can be hard to debug, which is why Execa includes a [`verbose`](#verbose-mode) option.845 846-Also, Execa's error messages and [properties](#errors) are very detailed to make it clear to determine why a subprocess failed. Error messages and stack traces can be set with [`subprocess.kill(error)`](../readme.md#killerror).846+Also, Execa's error messages and [properties](#errors) are very detailed to make it clear to determine why a subprocess failed. Error messages and stack traces can be set with [`subprocess.kill(error)`](../readme.md#subprocesskillerror).847 848 Finally, unlike Bash and zx, which are stateful (options, current directory, etc.), Execa is [purely functional](#current-directory), which also helps with debugging.modified:docs/transform.md+6 added-6 removed
1 # Transforms2 3 ## Summary4 5-Transforms map or filter the input or output of a subprocess. They are defined by passing a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) to the [`stdin`](../readme.md#stdin), [`stdout`](../readme.md#stdout-1), [`stderr`](../readme.md#stderr-1) or [`stdio`](../readme.md#stdio-1) option. It can be [`async`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function*).5+Transforms map or filter the input or output of a subprocess. They are defined by passing a [generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*) to the [`stdin`](../readme.md#optionsstdin), [`stdout`](../readme.md#optionsstdout), [`stderr`](../readme.md#optionsstderr) or [`stdio`](../readme.md#optionsstdio) option. It can be [`async`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function*).6 7 ```js8 import {execa} from 'execa';9 8 unmodified lines18 19 ## Encoding20 21 The `line` argument passed to the transform is a string by default.\22-However, if either a `{transform, binary: true}` plain object is passed, or if the [`encoding` option](../readme.md#encoding) is binary, it is an `Uint8Array` instead.22+However, if either a `{transform, binary: true}` plain object is passed, or if the [`encoding`](../readme.md#optionsencoding) option is binary, it is an `Uint8Array` instead.23 24 The transform can `yield` either a `string` or an `Uint8Array`, regardless of the `line` argument's type.25 26 ## Filtering15 unmodified lines42 43 ## Binary data44 45 The transform iterates over lines by default.\46-However, if either a `{transform, binary: true}` plain object is passed, or if the [`encoding` option](../readme.md#encoding) is binary, it iterates over arbitrary chunks of data instead.46+However, if either a `{transform, binary: true}` plain object is passed, or if the [`encoding`](../readme.md#optionsencoding) option is binary, it iterates over arbitrary chunks of data instead.47 48 ```js49 await execa('./binary.js', {stdout: {transform, binary: true}});50 ```64 unmodified lines115 116 ## Object mode117 118 By default, `stdout` and `stderr`'s transforms must return a string or an `Uint8Array`.\119-However, if a `{transform, objectMode: true}` plain object is passed, any type can be returned instead, except `null` or `undefined`. The subprocess' [`stdout`](../readme.md#stdout)/[`stderr`](../readme.md#stderr) will be an array of values.119+However, if a `{transform, objectMode: true}` plain object is passed, any type can be returned instead, except `null` or `undefined`. The subprocess' [`stdout`](../readme.md#resultstdout)/[`stderr`](../readme.md#resultstderr) will be an array of values.120 121 ```js122 const transform = function * (line) {123 yield JSON.parse(line);73 unmodified lines197 ```198 199 ## Combining200 201-The [`stdin`](../readme.md#stdin), [`stdout`](../readme.md#stdout-1), [`stderr`](../readme.md#stderr-1) and [`stdio`](../readme.md#stdio-1) options can accept an array of values. While this is not specific to transforms, this can be useful with them too. For example, the following transform impacts the value printed by `inherit`.201+The [`stdin`](../readme.md#optionsstdin), [`stdout`](../readme.md#optionsstdout), [`stderr`](../readme.md#optionsstderr) and [`stdio`](../readme.md#optionsstdio) options can accept an array of values. While this is not specific to transforms, this can be useful with them too. For example, the following transform impacts the value printed by `inherit`.202 203 ```js204 await execa('echo', ['hello'], {stdout: [transform, 'inherit']});205 ```11 unmodified lines217 ```218 219 ## Async iteration220 221-In some cases, [iterating](../readme.md#iterablereadableoptions) over the subprocess can be an alternative to transforms.221+In some cases, [iterating](../readme.md#subprocessiterablereadableoptions) over the subprocess can be an alternative to transforms.222 223 ```js224 import {execa} from 'execa';225 5 unmodified linesmodified:index.d.ts+27 added-27 removed
440 unmodified lines441 readonly stdin?: StdinOptionCommon<IsSync>;442 443 /**444 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the subprocess' standard output. This can be:445- - `'pipe'`: Sets `subprocessResult.stdout` (as a string or `Uint8Array`) and [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).445+ - `'pipe'`: Sets `result.stdout` (as a string or `Uint8Array`) and [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).446 - `'overlapped'`: Like `'pipe'` but asynchronous on Windows.447 - `'ignore'`: Do not use `stdout`.448 - `'inherit'`: Re-use the current process' `stdout`.449 - an integer: Re-use a specific file descriptor from the current process.11 unmodified lines461 readonly stdout?: StdoutStderrOptionCommon<IsSync>;462 463 /**464 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the subprocess' standard error. This can be:465- - `'pipe'`: Sets `subprocessResult.stderr` (as a string or `Uint8Array`) and [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).465+ - `'pipe'`: Sets `result.stderr` (as a string or `Uint8Array`) and [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).466 - `'overlapped'`: Like `'pipe'` but asynchronous on Windows.467 - `'ignore'`: Do not use `stderr`.468 - `'inherit'`: Re-use the current process' `stderr`.469 - an integer: Re-use a specific file descriptor from the current process.215 unmodified lines685 */686 readonly buffer?: boolean;687 688 /**689- Add an `.all` property on the promise and the resolved value. The property contains the output of the subprocess with `stdout` and `stderr` interleaved.689+ Add a `subprocess.all` stream and a `result.all` property. They contain the combined/[interleaved](#ensuring-all-output-is-interleaved) output of the subprocess' `stdout` and `stderr`.690 691 @default false692 */693 readonly all?: boolean;25 unmodified lines719 720 /**721 You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).722 723- When `AbortController.abort()` is called, `.isCanceled` becomes `true`.723+ When `AbortController.abort()` is called, `result.isCanceled` becomes `true`.724 725 @example726 ```727 import {execa} from 'execa';159 unmodified lines887 888 /**889 Results of the other subprocesses that were piped into this subprocess. This is useful to inspect a series of subprocesses piped with each other.890 891- This array is initially empty and is populated each time the `.pipe()` method resolves.891+ This array is initially empty and is populated each time the `subprocess.pipe()` method resolves.892 */893 pipedFrom: Unless<IsSync, ExecaResult[], []>;894 895 /**15 unmodified lines911 */912 originalMessage?: string;913 914 /**915- Underlying error, if there is one. For example, this is set by `.kill(error)`.915+ Underlying error, if there is one. For example, this is set by `subprocess.kill(error)`.916 917 This is usually an `Error` instance.918 */919 cause?: unknown;58 unmodified lines978 979 /**980 Exception thrown when the subprocess fails, either:981 - its exit code is not `0`982-- it was terminated with a signal, including `.kill()`982+- it was terminated with a signal, including `subprocess.kill()`983 - timing out984 - being canceled985 - there's not enough memory or there are already too many subprocesses986 73 unmodified lines1060 1061 /**1062 Unpipe the subprocess when the signal aborts.1063 1064- The `.pipe()` method will be rejected with a cancellation error.1064+ The `subprocess.pipe()` method will be rejected with a cancellation error.1065 */1066 readonly unpipeSignal?: AbortSignal;1067 };1068 17 unmodified lines1086 options?: OptionsType,1087 ): Promise<ExecaResult<OptionsType>> & PipableSubprocess;1088 1089 /**1090- Like `.pipe(file, arguments?, options?)` but using a `command` template string instead. This follows the same syntax as `$`.1090+ Like `subprocess.pipe(file, arguments?, options?)` but using a `command` template string instead. This follows the same syntax as `$`.1091 */1092 pipe(templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[]):1093 Promise<ExecaResult<{}>> & PipableSubprocess;1094 pipe<OptionsType extends Options & PipeOptions = {}>(options: OptionsType):1095 (templates: TemplateStringsArray, ...expressions: readonly TemplateExpression[])1096 => Promise<ExecaResult<OptionsType>> & PipableSubprocess;1097 1098 /**1099- Like `.pipe(file, arguments?, options?)` but using the return value of another `execa()` call instead.1099+ Like `subprocess.pipe(file, arguments?, options?)` but using the return value of another `execa()` call instead.1100 1101 This is the most advanced method to pipe subprocesses. It is useful in specific cases, such as piping multiple subprocesses to the same subprocess.1102 */1103 pipe<Destination extends ExecaSubprocess>(destination: Destination, options?: PipeOptions):12 unmodified lines1116 1117 /**1118 If `false`, the stream iterates over lines. Each line is a string. Also, the stream is in [object mode](https://nodejs.org/api/stream.html#object-mode).1119 1120- If `true`, the stream iterates over arbitrary chunks of data. Each line is an `Uint8Array` (with `.iterable()`) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (otherwise).1120+ If `true`, the stream iterates over arbitrary chunks of data. Each line is an `Uint8Array` (with `subprocess.iterable()`) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (otherwise).1121 1122 This is always `true` when the `encoding` option is binary.1123 1124- @default `false` with `.iterable()`, `true` otherwise1124+ @default `false` with `subprocess.iterable()`, `true` otherwise1125 */1126 readonly binary?: boolean;1127 1128 /**1129 If both this option and the `binary` option is `false`, newlines are stripped from each line.1130 1131- @default `false` with `.iterable()`, `true` otherwise1131+ @default `false` with `subprocess.iterable()`, `true` otherwise1132 */1133 readonly preserveNewlines?: boolean;1134 };1135 135 unmodified lines1271 1272 @param file - The program/script to execute, as a string or file URL1273 @param arguments - Arguments to pass to `file` on execution.1274 @returns An `ExecaSubprocess` that is both:1275-- a `Promise` resolving or rejecting with a `subprocessResult`.1275+- a `Promise` resolving or rejecting with a subprocess `result`.1276 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.1277-@throws A `subprocessResult` error1277+@throws A subprocess `result` error1278 1279 @example <caption>Promise interface</caption>1280 ```1281 import {execa} from 'execa';173 unmodified lines1455 1456 /**1457 Same as `execa()` but synchronous.1458 1459-Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available.1459+Returns or throws a subprocess `result`. The `subprocess` is not returned: its methods and properties are not available.1460 1461 The following features cannot be used:1462 - Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), `subprocess.readable()`, `subprocess.writable()`, `subprocess.duplex()`.1463 - The `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.6 unmodified lines1470 - The `maxBuffer` option is always measured in bytes, not in characters, lines nor objects. Also, it ignores transforms and the `encoding` option.1471 1472 @param file - The program/script to execute, as a string or file URL1473 @param arguments - Arguments to pass to `file` on execution.1474-@returns A `subprocessResult` object1475-@throws A `subprocessResult` error1474+@returns A subprocess `result` object1475+@throws A subprocess `result` error1476 1477 @example <caption>Promise interface</caption>1478 ```1479 import {execa} from 'execa';70 unmodified lines1550 Arguments are automatically escaped. They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.1551 1552 @param command - The program/script to execute and its arguments.1553 @returns An `ExecaSubprocess` that is both:1554-- a `Promise` resolving or rejecting with a `subprocessResult`.1554+- a `Promise` resolving or rejecting with a subprocess `result`.1555 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.1556-@throws A `subprocessResult` error1556+@throws A subprocess `result` error1557 1558 @example1559 ```1560 import {execaCommand} from 'execa';18 unmodified lines1579 1580 /**1581 Same as `execaCommand()` but synchronous.1582 1583-Returns or throws a `subprocessResult`. The `subprocess` is not returned: its methods and properties are not available.1583+Returns or throws a subprocess `result`. The `subprocess` is not returned: its methods and properties are not available.1584 1585 The following features cannot be used:1586 - Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), `subprocess.readable()`, `subprocess.writable()`, `subprocess.duplex()`.1587 - The `stdin`, `stdout`, `stderr` and `stdio` options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async transform, a `Duplex`, nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.5 unmodified lines1593 - `detached` option.1594 - The `maxBuffer` option is always measured in bytes, not in characters, lines nor objects. Also, it ignores transforms and the `encoding` option.1595 1596 @param command - The program/script to execute and its arguments.1597-@returns A `subprocessResult` object1598-@throws A `subprocessResult` error1597+@returns A subprocess `result` object1598+@throws A subprocess `result` error1599 1600 @example1601 ```1602 import {execaCommandSync} from 'execa';51 unmodified lines1654 1655 This is the preferred method when executing multiple commands in a script file.1656 1657 @returns An `ExecaSubprocess` that is both:1658- - a `Promise` resolving or rejecting with a `subprocessResult`.1658+ - a `Promise` resolving or rejecting with a subprocess `result`.1659 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.1660-@throws A `subprocessResult` error1660+@throws A subprocess `result` error1661 1662 @example <caption>Basic</caption>1663 ```1664 import {$} from 'execa';46 unmodified lines1711 1712 @param scriptPath - Node.js script to execute, as a string or file URL1713 @param arguments - Arguments to pass to `scriptPath` on execution.1714 @returns An `ExecaSubprocess` that is both:1715-- a `Promise` resolving or rejecting with a `subprocessResult`.1715+- a `Promise` resolving or rejecting with a subprocess `result`.1716 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with some additional methods and properties.1717-@throws A `subprocessResult` error1717+@throws A subprocess `result` error1718 1719 @example1720 ```1721 import {execaNode} from 'execa';5 unmodified linesmodified:readme.md+181 added-181 removed
48 unmodified lines49 50 - [Promise interface](#execafile-arguments-options).51 - [Script interface](docs/scripts.md) and [template strings](#template-string-syntax), like `zx`.52 - Improved [Windows support](https://github.com/IndigoUnited/node-cross-spawn#why), including [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries.53-- Executes [locally installed binaries](#preferlocal) without `npx`.54-- [Cleans up](#cleanup) subprocesses when the current process ends.55-- Redirect [`stdin`](#stdin)/[`stdout`](#stdout-1)/[`stderr`](#stderr-1) from/to files, streams, iterables, strings, `Uint8Array` or [objects](docs/transform.md#object-mode).53+- Executes [locally installed binaries](#optionspreferlocal) without `npx`.54+- [Cleans up](#optionscleanup) subprocesses when the current process ends.55+- Redirect [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr) from/to files, streams, iterables, strings, `Uint8Array` or [objects](docs/transform.md#object-mode).56 - [Transform](docs/transform.md) `stdin`/`stdout`/`stderr` with simple functions.57 - Iterate over [each text line](docs/transform.md#binary-data) output by the subprocess.58-- [Fail-safe subprocess termination](#forcekillafterdelay).59-- Get [interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal.60-- [Strips the final newline](#stripfinalnewline) from the output so you don't have to do `stdout.trim()`.61-- Convenience methods to pipe subprocesses' [input](#input) and [output](#redirect-output-to-a-file).58+- [Fail-safe subprocess termination](#optionsforcekillafterdelay).59+- Get [interleaved output](#optionsall) from `stdout` and `stderr` similar to what is printed on the terminal.60+- [Strips the final newline](#optionsstripfinalnewline) from the output so you don't have to do `stdout.trim()`.61+- Convenience methods to pipe subprocesses' [input](#redirect-input-from-a-file) and [output](#redirect-output-to-a-file).62 - [Verbose mode](#verbose-mode) for debugging.63 - More descriptive errors.64 - Higher max buffer: 100 MB instead of 1 MB.65 231 unmodified lines297 _Returns_: [`Subprocess`](#subprocess)298 299 Executes a command. `command` is a [template string](#template-string-syntax) and includes both the `file` and its `arguments`.300 301-The `command` template string can inject any `${value}` with the following types: string, number, [`subprocess`](#subprocess) or an array of those types. For example: `` execa`echo one ${'two'} ${3} ${['four', 'five']}` ``. For `${subprocess}`, the subprocess's [`stdout`](#stdout) is used.301+The `command` template string can inject any `${value}` with the following types: string, number, [`subprocess`](#subprocess) or an array of those types. For example: `` execa`echo one ${'two'} ${3} ${['four', 'five']}` ``. For `${subprocess}`, the subprocess's [`stdout`](#resultstdout) is used.302 303 Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces, tabs and newlines must use `${}` like `` execa`echo ${'has space'}` ``.304 305 The `command` template string can use [multiple lines and indentation](docs/scripts.md#multiline-commands).11 unmodified lines317 #### execaSync\`command\`318 319 Same as [`execa()`](#execafile-arguments-options) but synchronous.320 321-Returns or throws a [`subprocessResult`](#subprocessResult). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.321+Returns or throws a subprocess [`result`](#result). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.322 323 The following features cannot be used:324-- Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), [`subprocess.readable()`](#readablereadableoptions), [`subprocess.writable()`](#writablewritableoptions), [`subprocess.duplex()`](#duplexduplexoptions).325-- The [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1) and [`stdio`](#stdio-1) options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async [transform](docs/transform.md), a [`Duplex`](docs/transform.md#duplextransform-streams), nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.326-- Signal termination: [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`subprocess.pid`](https://nodejs.org/api/child_process.html#subprocesspid), [`cleanup`](#cleanup) option, [`cancelSignal`](#cancelsignal) option, [`forceKillAfterDelay`](#forcekillafterdelay) option.327-- Piping multiple processes: [`subprocess.pipe()`](#pipefile-arguments-options).328-- [`subprocess.iterable()`](#iterablereadableoptions).329-- [`ipc`](#ipc) and [`serialization`](#serialization) options.330-- [`result.all`](#all-1) is not interleaved.331-- [`detached`](#detached) option.332-- The [`maxBuffer`](#maxbuffer) option is always measured in bytes, not in characters, [lines](#lines) nor [objects](docs/transform.md#object-mode). Also, it ignores transforms and the [`encoding`](#encoding) option.324+- Streams: [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), [`subprocess.readable()`](#subprocessreadablereadableoptions), [`subprocess.writable()`](#subprocesswritablewritableoptions), [`subprocess.duplex()`](#subprocessduplexduplexoptions).325+- The [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [`stdio`](#optionsstdio) options cannot be [`'overlapped'`](https://nodejs.org/api/child_process.html#optionsstdio), an async iterable, an async [transform](docs/transform.md), a [`Duplex`](docs/transform.md#duplextransform-streams), nor a web stream. Node.js streams can be passed but only if either they [have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr), or the `input` option is used.326+- Signal termination: [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal), [`subprocess.pid`](https://nodejs.org/api/child_process.html#subprocesspid), [`cleanup`](#optionscleanup) option, [`cancelSignal`](#optionscancelsignal) option, [`forceKillAfterDelay`](#optionsforcekillafterdelay) option.327+- Piping multiple processes: [`subprocess.pipe()`](#subprocesspipefile-arguments-options).328+- [`subprocess.iterable()`](#subprocessiterablereadableoptions).329+- [`ipc`](#optionsipc) and [`serialization`](#optionsserialization) options.330+- [`result.all`](#resultall) is not interleaved.331+- [`detached`](#optionsdetached) option.332+- The [`maxBuffer`](#optionsmaxbuffer) option is always measured in bytes, not in characters, [lines](#optionslines) nor [objects](docs/transform.md#object-mode). Also, it ignores transforms and the [`encoding`](#optionsencoding) option.333 334 #### $(file, arguments?, options?)335 336 `file`: `string | URL`\337 `arguments`: `string[]`\338 `options`: [`Options`](#options)\339 _Returns_: [`Subprocess`](#subprocess)340 341-Same as [`execa()`](#execafile-arguments-options) but using the [`stdin: 'inherit'`](#stdin) and [`preferLocal: true`](#preferlocal) options.341+Same as [`execa()`](#execafile-arguments-options) but using the [`stdin: 'inherit'`](#optionsstdin) and [`preferLocal: true`](#optionspreferlocal) options.342 343 Just like `execa()`, this can use the [template string syntax](#execacommand) or [bind options](#execaoptions). It can also be [run synchronously](#execasyncfile-arguments-options) using `$.sync()` or `$.s()`.344 345 This is the preferred method when executing multiple commands in a script file. For more information, please see [this page](docs/scripts.md).4 unmodified lines350 `arguments`: `string[]`\351 `options`: [`Options`](#options)\352 _Returns_: [`Subprocess`](#subprocess)353 354-Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#node) option.354+Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.355 Executes a Node.js file using `node scriptPath ...arguments`.356 357 Just like `execa()`, this can use the [template string syntax](#execacommand) or [bind options](#execaoptions).358 14 unmodified lines373 Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.374 375 ### Shell syntax376 377-For all the [methods above](#methods), no shell interpreter (Bash, cmd.exe, etc.) is used unless the [`shell` option](#shell) is set. This means shell-specific characters and expressions (`$variable`, `&&`, `||`, `;`, `|`, etc.) have no special meaning and do not need to be escaped.377+For all the [methods above](#methods), no shell interpreter (Bash, cmd.exe, etc.) is used unless the [`shell`](#optionsshell) option is set. This means shell-specific characters and expressions (`$variable`, `&&`, `||`, `;`, `|`, etc.) have no special meaning and do not need to be escaped.378 379 ### subprocess380 381 The return value of all [asynchronous methods](#methods) is both:382-- a `Promise` resolving or rejecting with a [`subprocessResult`](#subprocessResult).382+- a `Promise` resolving or rejecting with a subprocess [`result`](#result).383 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following additional methods and properties.384 385-#### all385+#### subprocess.all386 387 Type: `ReadableStream | undefined`388 389 Stream [combining/interleaving](#ensuring-all-output-is-interleaved) [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).390 391 This is `undefined` if either:392-- the [`all` option](#all-2) is `false` (the default value)393-- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)392+- the [`all`](#optionsall) option is `false` (the default value)393+- both [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are set to [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)394 395-#### pipe(file, arguments?, options?)395+#### subprocess.pipe(file, arguments?, options?)396 397 `file`: `string | URL`\398 `arguments`: `string[]`\399 `options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\400-_Returns_: [`Promise<SubprocessResult>`](#subprocessresult)400+_Returns_: [`Promise<Result>`](#result)401 402-[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' `stdout` to a second Execa subprocess' `stdin`. This resolves with that second subprocess' [result](#subprocessresult). If either subprocess is rejected, this is rejected with that subprocess' [error](#execaerror) instead.402+[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' `stdout` to a second Execa subprocess' `stdin`. This resolves with that second subprocess' [result](#result). If either subprocess is rejected, this is rejected with that subprocess' [error](#execaerror) instead.403 404 This follows the same syntax as [`execa(file, arguments?, options?)`](#execafile-arguments-options) except both [regular options](#options) and [pipe-specific options](#pipeoptions) can be specified.405 406 This can be called multiple times to chain a series of subprocesses.407 408 Multiple subprocesses can be piped to the same subprocess. Conversely, the same subprocess can be piped to multiple other subprocesses.409 410-#### pipe\`command\`411-#### pipe(options)\`command\`410+#### subprocess.pipe\`command\`411+#### subprocess.pipe(options)\`command\`412 413 `command`: `string`\414 `options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\415-_Returns_: [`Promise<SubprocessResult>`](#subprocessresult)415+_Returns_: [`Promise<Result>`](#result)416 417-Like [`.pipe(file, arguments?, options?)`](#pipefile-arguments-options) but using a [`command` template string](docs/scripts.md#piping-stdout-to-another-command) instead. This follows the same syntax as `execa` [template strings](#execacommand).417+Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using a [`command` template string](docs/scripts.md#piping-stdout-to-another-command) instead. This follows the same syntax as `execa` [template strings](#execacommand).418 419-#### pipe(secondSubprocess, pipeOptions?)419+#### subprocess.pipe(secondSubprocess, pipeOptions?)420 421 `secondSubprocess`: [`execa()` return value](#subprocess)\422 `pipeOptions`: [`PipeOptions`](#pipeoptions)\423-_Returns_: [`Promise<SubprocessResult>`](#subprocessresult)423+_Returns_: [`Promise<Result>`](#result)424 425-Like [`.pipe(file, arguments?, options?)`](#pipefile-arguments-options) but using the [return value](#subprocess) of another `execa()` call instead.425+Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using the [return value](#subprocess) of another `execa()` call instead.426 427 This is the most advanced method to pipe subprocesses. It is useful in specific cases, such as piping multiple subprocesses to the same subprocess.428 429 ##### pipeOptions6 unmodified lines436 Default: `"stdout"`437 438 Which stream to pipe from the source subprocess. A file descriptor like `"fd3"` can also be passed.439 440-`"all"` pipes both `stdout` and `stderr`. This requires the [`all` option](#all-2) to be `true`.440+`"all"` pipes both `stdout` and `stderr`. This requires the [`all`](#optionsall) option to be `true`.441 442 ##### pipeOptions.to443 444 Type: `"stdin" | "fd3" | "fd4" | ...`\6 unmodified lines451 Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)452 453 Unpipe the subprocess when the signal aborts.454 455-The [`.pipe()`](#pipefile-arguments-options) method will be rejected with a cancellation error.455+The [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method will be rejected with a cancellation error.456 457-#### kill(signal, error?)458-#### kill(error?)457+#### subprocess.kill(signal, error?)458+#### subprocess.kill(error?)459 460 `signal`: `string | number`\461 `error`: `Error`\462 _Returns_: `boolean`463 464-Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the [`killSignal`](#killsignal) option. `killSignal` defaults to `SIGTERM`, which [terminates](#isterminated) the subprocess.464+Sends a [signal](https://nodejs.org/api/os.html#signal-constants) to the subprocess. The default signal is the [`killSignal`](#optionskillsignal) option. `killSignal` defaults to `SIGTERM`, which [terminates](#resultisterminated) the subprocess.465 466 This returns `false` when the signal could not be sent, for example when the subprocess has already exited.467 468-When an error is passed as argument, it is set to the subprocess' [`error.cause`](#cause). The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).468+When an error is passed as argument, it is set to the subprocess' [`error.cause`](#errorcause). The subprocess is then terminated with the default signal. This does not emit the [`error` event](https://nodejs.org/api/child_process.html#event-error).469 470 [More info.](https://nodejs.org/api/child_process.html#subprocesskillsignal)471 472-#### [Symbol.asyncIterator]()472+#### subprocess[Symbol.asyncIterator]()473 474 _Returns_: `AsyncIterable`475 476 Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.477 478-The iteration waits for the subprocess to end. It throws if the subprocess [fails](#subprocessresult). This means you do not need to `await` the subprocess' [promise](#subprocess).478+The iteration waits for the subprocess to end. It throws if the subprocess [fails](#result). This means you do not need to `await` the subprocess' [promise](#subprocess).479 480-#### iterable(readableOptions?)480+#### subprocess.iterable(readableOptions?)481 482 `readableOptions`: [`ReadableOptions`](#readableoptions)\483 _Returns_: `AsyncIterable`484 485-Same as [`subprocess[Symbol.asyncIterator]`](#symbolasynciterator) except [options](#readableoptions) can be provided.485+Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.486 487-#### readable(readableOptions?)487+#### subprocess.readable(readableOptions?)488 489 `readableOptions`: [`ReadableOptions`](#readableoptions)\490 _Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream491 492 Converts the subprocess to a readable stream.493 494-Unlike [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), the stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#subprocessresult). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options), [`await pipeline(..., stream)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) or [`await text(stream)`](https://nodejs.org/api/webstreams.html#streamconsumerstextstream) which throw an exception when the stream errors.494+Unlike [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), the stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#result). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options), [`await pipeline(..., stream)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) or [`await text(stream)`](https://nodejs.org/api/webstreams.html#streamconsumerstextstream) which throw an exception when the stream errors.495 496-Before using this method, please first consider the [`stdin`](#stdin)/[`stdout`](#stdout-1)/[`stderr`](#stderr-1)/[`stdio`](#stdio-1) options, [`subprocess.pipe()`](#pipefile-arguments-options) or [`subprocess.iterable()`](#iterablereadableoptions).496+Before using this method, please first consider the [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr)/[`stdio`](#optionsstdio) options, [`subprocess.pipe()`](#subprocesspipefile-arguments-options) or [`subprocess.iterable()`](#subprocessiterablereadableoptions).497 498-#### writable(writableOptions?)498+#### subprocess.writable(writableOptions?)499 500 `writableOptions`: [`WritableOptions`](#writableoptions)\501 _Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream502 503 Converts the subprocess to a writable stream.504 505-Unlike [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), the stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#subprocessresult). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options) or [`await pipeline(stream, ...)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) which throw an exception when the stream errors.505+Unlike [`subprocess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin), the stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#result). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options) or [`await pipeline(stream, ...)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) which throw an exception when the stream errors.506 507-Before using this method, please first consider the [`stdin`](#stdin)/[`stdout`](#stdout-1)/[`stderr`](#stderr-1)/[`stdio`](#stdio-1) options or [`subprocess.pipe()`](#pipefile-arguments-options).507+Before using this method, please first consider the [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr)/[`stdio`](#optionsstdio) options or [`subprocess.pipe()`](#subprocesspipefile-arguments-options).508 509-#### duplex(duplexOptions?)509+#### subprocess.duplex(duplexOptions?)510 511 `duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\512 _Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream513 514 Converts the subprocess to a duplex stream.515 516-The stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#subprocessresult). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options), [`await pipeline(..., stream, ...)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) or [`await text(stream)`](https://nodejs.org/api/webstreams.html#streamconsumerstextstream) which throw an exception when the stream errors.516+The stream waits for the subprocess to end and emits an [`error`](https://nodejs.org/api/stream.html#event-error) event if the subprocess [fails](#result). This means you do not need to `await` the subprocess' [promise](#subprocess). On the other hand, you do need to handle to the stream `error` event. This can be done by using [`await finished(stream)`](https://nodejs.org/api/stream.html#streamfinishedstream-options), [`await pipeline(..., stream, ...)`](https://nodejs.org/api/stream.html#streampipelinesource-transforms-destination-options) or [`await text(stream)`](https://nodejs.org/api/webstreams.html#streamconsumerstextstream) which throw an exception when the stream errors.517 518-Before using this method, please first consider the [`stdin`](#stdin)/[`stdout`](#stdout-1)/[`stderr`](#stderr-1)/[`stdio`](#stdio-1) options, [`subprocess.pipe()`](#pipefile-arguments-options) or [`subprocess.iterable()`](#iterablereadableoptions).518+Before using this method, please first consider the [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr)/[`stdio`](#optionsstdio) options, [`subprocess.pipe()`](#subprocesspipefile-arguments-options) or [`subprocess.iterable()`](#subprocessiterablereadableoptions).519 520 ##### readableOptions521 522 Type: `object`4 unmodified lines527 Default: `"stdout"`528 529 Which stream to read from the subprocess. A file descriptor like `"fd3"` can also be passed.530 531-`"all"` reads both `stdout` and `stderr`. This requires the [`all` option](#all-2) to be `true`.531+`"all"` reads both `stdout` and `stderr`. This requires the [`all`](#optionsall) option to be `true`.532 533 ##### readableOptions.binary534 535 Type: `boolean`\536-Default: `false` with [`.iterable()`](#iterablereadableoptions), `true` with [`.readable()`](#readablereadableoptions)/[`.duplex()`](#duplexduplexoptions)536+Default: `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)537 538 If `false`, the stream iterates over lines. Each line is a string. Also, the stream is in [object mode](https://nodejs.org/api/stream.html#object-mode).539 540-If `true`, the stream iterates over arbitrary chunks of data. Each line is an `Uint8Array` (with [`.iterable()`](#iterablereadableoptions)) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (otherwise).540+If `true`, the stream iterates over arbitrary chunks of data. Each line is an `Uint8Array` (with [`subprocess.iterable()`](#subprocessiterablereadableoptions)) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (otherwise).541 542-This is always `true` when the [`encoding` option](#encoding) is binary.542+This is always `true` when the [`encoding`](#optionsencoding) option is binary.543 544 ##### readableOptions.preserveNewlines545 546 Type: `boolean`\547-Default: `false` with [`.iterable()`](#iterablereadableoptions), `true` with [`.readable()`](#readablereadableoptions)/[`.duplex()`](#duplexduplexoptions)547+Default: `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)548 549-If both this option and the [`binary` option](#readableoptionsbinary) is `false`, newlines are stripped from each line.549+If both this option and the [`binary`](#readableoptionsbinary) option is `false`, newlines are stripped from each line.550 551 ##### writableOptions552 553 Type: `object`4 unmodified lines558 Default: `"stdin"`559 560 Which stream to write to the subprocess. A file descriptor like `"fd3"` can also be passed.561 562-### SubprocessResult562+### Result563 564 Type: `object`565 566 Result of a subprocess execution.567 568-When the subprocess [fails](#failed), it is rejected with an [`ExecaError`](#execaerror) instead.568+When the subprocess [fails](#resultfailed), it is rejected with an [`ExecaError`](#execaerror) instead.569 570-#### command570+#### result.command571 572 Type: `string`573 574 The file and arguments that were run, for logging purposes.575 576 This is not escaped and should not be executed directly as a subprocess, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).577 578-#### escapedCommand578+#### result.escapedCommand579 580 Type: `string`581 582-Same as [`command`](#command) but escaped.582+Same as [`command`](#resultcommand) but escaped.583 584 Unlike `command`, control characters are escaped, which makes it safe to print in a terminal.585 586 This can also be copied and pasted into a shell, for debugging purposes.587 Since the escaping is fairly basic, this should not be executed directly as a subprocess, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).588 589-#### cwd589+#### result.cwd590 591 Type: `string`592 593-The [current directory](#cwd-1) in which the command was run.593+The [current directory](#optionscwd) in which the command was run.594 595-#### durationMs595+#### result.durationMs596 597 Type: `number`598 599 Duration of the subprocess, in milliseconds.600 601-#### stdout601+#### result.stdout602 603 Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`604 605 The output of the subprocess on `stdout`.606 607-This is `undefined` if the [`stdout`](#stdout-1) option is set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the [`lines` option](#lines) is `true`, or if the `stdout` option is a [transform in object mode](docs/transform.md#object-mode).607+This is `undefined` if the [`stdout`](#optionsstdout) option is set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the [`lines`](#optionslines) option is `true`, or if the `stdout` option is a [transform in object mode](docs/transform.md#object-mode).608 609-#### stderr609+#### result.stderr610 611 Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`612 613 The output of the subprocess on `stderr`.614 615-This is `undefined` if the [`stderr`](#stderr-1) option is set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the [`lines` option](#lines) is `true`, or if the `stderr` option is a [transform in object mode](docs/transform.md#object-mode).615+This is `undefined` if the [`stderr`](#optionsstderr) option is set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the [`lines`](#optionslines) option is `true`, or if the `stderr` option is a [transform in object mode](docs/transform.md#object-mode).616 617-#### all617+#### result.all618 619 Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`620 621 The output of the subprocess with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).622 623 This is `undefined` if either:624-- the [`all` option](#all-2) is `false` (the default value)625-- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)624+- the [`all`](#optionsall) option is `false` (the default value)625+- both [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are set to only [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)626 627-This is an array if the [`lines` option](#lines) is `true`, or if either the `stdout` or `stderr` option is a [transform in object mode](docs/transform.md#object-mode).627+This is an array if the [`lines`](#optionslines) option is `true`, or if either the `stdout` or `stderr` option is a [transform in object mode](docs/transform.md#object-mode).628 629-#### stdio629+#### result.stdio630 631 Type: `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`632 633-The output of the subprocess on [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1) and [other file descriptors](#stdio-1).633+The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).634 635-Items are `undefined` when their corresponding [`stdio`](#stdio-1) option is set to [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). Items are arrays when their corresponding `stdio` option is a [transform in object mode](docs/transform.md#object-mode).635+Items are `undefined` when their corresponding [`stdio`](#optionsstdio) option is set to [`'inherit'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). Items are arrays when their corresponding `stdio` option is a [transform in object mode](docs/transform.md#object-mode).636 637-#### failed637+#### result.failed638 639 Type: `boolean`640 641 Whether the subprocess failed to run.642 643-#### timedOut643+#### result.timedOut644 645 Type: `boolean`646 647 Whether the subprocess timed out.648 649-#### isCanceled649+#### result.isCanceled650 651 Type: `boolean`652 653-Whether the subprocess was canceled using the [`cancelSignal`](#cancelsignal) option.653+Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.654 655-#### isTerminated655+#### result.isTerminated656 657 Type: `boolean`658 659 Whether the subprocess was terminated by a signal (like `SIGTERM`) sent by either:660 - The current process.661 - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).662 663-#### isMaxBuffer663+#### result.isMaxBuffer664 665 Type: `boolean`666 667-Whether the subprocess failed because its output was larger than the [`maxBuffer`](#maxbuffer) option.667+Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.668 669-#### exitCode669+#### result.exitCode670 671 Type: `number | undefined`672 673 The numeric exit code of the subprocess that was run.674 675-This is `undefined` when the subprocess could not be spawned or was terminated by a [signal](#signal).675+This is `undefined` when the subprocess could not be spawned or was terminated by a [signal](#resultsignal).676 677-#### signal677+#### result.signal678 679 Type: `string | undefined`680 681 The name of the signal (like `SIGTERM`) that terminated the subprocess, sent by either:1 unmodified line683 - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).684 685 If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.686 687-#### signalDescription687+#### result.signalDescription688 689 Type: `string | undefined`690 691 A human-friendly description of the signal that was used to terminate the subprocess. For example, `Floating point arithmetic error`.692 693 If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`. It is also `undefined` when the signal is very uncommon which should seldomly happen.694 695-#### pipedFrom695+#### result.pipedFrom696 697-Type: [`Array<SubprocessResult | ExecaError>`](#subprocessresult)697+Type: [`Array<Result | ExecaError>`](#result)698 699 Results of the other subprocesses that were [piped](#pipe-multiple-subprocesses) into this subprocess. This is useful to inspect a series of subprocesses piped with each other.700 701-This array is initially empty and is populated each time the [`.pipe()`](#pipefile-arguments-options) method resolves.701+This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.702 703 ### ExecaError704 ### ExecaSyncError705 706 Type: `Error`707 708-Exception thrown when the subprocess [fails](#failed), either:709-- its [exit code](#exitcode) is not `0`710-- it was [terminated](#isterminated) with a [signal](#signal), including [`.kill()`](#killerror)711-- [timing out](#timedout)712-- [being canceled](#iscanceled)708+Exception thrown when the subprocess [fails](#resultfailed), either:709+- its [exit code](#resultexitcode) is not `0`710+- it was [terminated](#resultisterminated) with a [signal](#resultsignal), including [`subprocess.kill()`](#subprocesskillerror)711+- [timing out](#resulttimedout)712+- [being canceled](#resultiscanceled)713 - there's not enough memory or there are already too many subprocesses714 715-This has the same shape as [successful results](#subprocessresult), with the following additional properties.715+This has the same shape as [successful results](#result), with the following additional properties.716 717-#### message717+#### error.message718 719 Type: `string`720 721-Error message when the subprocess failed to run. In addition to the [underlying error message](#originalMessage), it also contains some information related to why the subprocess errored.721+Error message when the subprocess failed to run. In addition to the [underlying error message](#errororiginalmessage), it also contains some information related to why the subprocess errored.722 723-The subprocess [`stderr`](#stderr), [`stdout`](#stdout) and other [file descriptors' output](#stdio) are appended to the end, separated with newlines and not interleaved.723+The subprocess [`stderr`](#resultstderr), [`stdout`](#resultstdout) and other [file descriptors' output](#resultstdio) are appended to the end, separated with newlines and not interleaved.724 725-#### shortMessage725+#### error.shortMessage726 727 Type: `string`728 729-This is the same as the [`message` property](#message) except it does not include the subprocess [`stdout`](#stdout)/[`stderr`](#stderr)/[`stdio`](#stdio).729+This is the same as the [`message` property](#errormessage) except it does not include the subprocess [`stdout`](#resultstdout)/[`stderr`](#resultstderr)/[`stdio`](#resultstdio).730 731-#### originalMessage731+#### error.originalMessage732 733 Type: `string | undefined`734 735-Original error message. This is the same as the `message` property excluding the subprocess [`stdout`](#stdout)/[`stderr`](#stderr)/[`stdio`](#stdio) and some additional information added by Execa.735+Original error message. This is the same as the `message` property excluding the subprocess [`stdout`](#resultstdout)/[`stderr`](#resultstderr)/[`stdio`](#resultstdio) and some additional information added by Execa.736 737 This exists only if the subprocess exited due to an `error` event or a timeout.738 739-#### cause739+#### error.cause740 741 Type: `unknown | undefined`742 743-Underlying error, if there is one. For example, this is set by [`.kill(error)`](#killerror).743+Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).744 745 This is usually an `Error` instance.746 747-#### code747+#### error.code748 749 Type: `string | undefined`750 751 Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.3 unmodified lines755 Type: `object`756 757 This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).758 759-Some options are related to the subprocess output: [`maxBuffer`](#maxbuffer). By default, those options apply to all file descriptors (`stdout`, `stderr`, etc.). A plain object can be passed instead to apply them to only `stdout`, `stderr`, `fd3`, etc.759+Some options are related to the subprocess output: [`maxBuffer`](#optionsmaxbuffer). By default, those options apply to all file descriptors (`stdout`, `stderr`, etc.). A plain object can be passed instead to apply them to only `stdout`, `stderr`, `fd3`, etc.760 761 ```js762 await execa('./run.js', {maxBuffer: 1e6}) // Same value for stdout and stderr763 await execa('./run.js', {maxBuffer: {stdout: 1e4, stderr: 1e6}}) // Different values764 ```765 766-#### reject766+#### options.reject767 768 Type: `boolean`\769 Default: `true`770 771 Setting this to `false` resolves the promise with the [error](#execaerror) instead of rejecting it.772 773-#### shell773+#### options.shell774 775 Type: `boolean | string | URL`\776 Default: `false`777 3 unmodified lines781 - not cross-platform, encouraging shell-specific syntax.782 - slower, because of the additional shell interpretation.783 - unsafe, potentially allowing command injection.784 785-#### cwd785+#### options.cwd786 787 Type: `string | URL`\788 Default: `process.cwd()`789 790 Current working directory of the subprocess.791 792-This is also used to resolve the [`nodePath`](#nodepath) option when it is a relative path.792+This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.793 794-#### env794+#### options.env795 796 Type: `object`\797 Default: `process.env`798 799 Environment key-value pairs.800 801-Unless the [`extendEnv` option](#extendenv) is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).801+Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).802 803-#### extendEnv803+#### options.extendEnv804 805 Type: `boolean`\806 Default: `true`807 808-If `true`, the subprocess uses both the [`env` option](#env) and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).808+If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).809 If `false`, only the `env` option is used, not `process.env`.810 811-#### preferLocal811+#### options.preferLocal812 813 Type: `boolean`\814 Default: `true` with [`$`](#file-arguments-options), `false` otherwise815 816 Prefer locally installed binaries when looking for a binary to execute.\817 If you `$ npm install foo`, you can then `execa('foo')`.818 819-#### localDir819+#### options.localDir820 821 Type: `string | URL`\822 Default: `process.cwd()`823 824 Preferred path to find locally installed binaries in (use with `preferLocal`).825 826-#### node826+#### options.node827 828 Type: `boolean`\829 Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise830 831 If `true`, runs with Node.js. The first argument must be a Node.js file.832 833-#### nodeOptions833+#### options.nodeOptions834 835 Type: `string[]`\836 Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)837 838-List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#nodepath).838+List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).839 840-Requires the [`node`](#node) option to be `true`.840+Requires the [`node`](#optionsnode) option to be `true`.841 842-#### nodePath842+#### options.nodePath843 844 Type: `string | URL`\845 Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)846 847 Path to the Node.js executable.848 849 For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version.850 851-Requires the [`node`](#node) option to be `true`.851+Requires the [`node`](#optionsnode) option to be `true`.852 853-#### verbose853+#### options.verbose854 855 Type: `'none' | 'short' | 'full'`\856 Default: `'none'`857 858 If `verbose` is `'short'` or `'full'`, [prints each command](#verbose-mode) on `stderr` before executing it. When the command completes, prints its duration and (if it failed) its error.859 860 If `verbose` is `'full'`, the command's `stdout` and `stderr` are printed too, unless either:861-- the [`stdout`](#stdout-1)/[`stderr`](#stderr-1) option is `ignore` or `inherit`.862-- the `stdout`/`stderr` is redirected to [a stream](https://nodejs.org/api/stream.html#readablepipedestination-options), [a file](#stdout-1), a file descriptor, or [another subprocess](#pipefile-arguments-options).863-- the [`encoding` option](#encoding) is binary.861+- the [`stdout`](#optionsstdout)/[`stderr`](#optionsstderr) option is `ignore` or `inherit`.862+- the `stdout`/`stderr` is redirected to [a stream](https://nodejs.org/api/stream.html#readablepipedestination-options), [a file](#optionsstdout), a file descriptor, or [another subprocess](#subprocesspipefile-arguments-options).863+- the [`encoding`](#optionsencoding) option is binary.864 865 This can also be set to `'full'` by setting the `NODE_DEBUG=execa` environment variable in the current process.866 867-#### buffer867+#### options.buffer868 869 Type: `boolean`\870 Default: `true`871 872-Whether to return the subprocess' output using the [`result.stdout`](#stdout), [`result.stderr`](#stderr), [`result.all`](#all-1) and [`result.stdio`](#stdio) properties.872+Whether to return the subprocess' output using the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties.873 874-On failure, the [`error.stdout`](#stdout), [`error.stderr`](#stderr), [`error.all`](#all-1) and [`error.stdio`](#stdio) properties are used instead.874+On failure, the [`error.stdout`](#resultstdout), [`error.stderr`](#resultstderr), [`error.all`](#resultall) and [`error.stdio`](#resultstdio) properties are used instead.875 876-When `buffer` is `false`, the output can still be read using the [`subprocess.stdout`](#stdout-1), [`subprocess.stderr`](#stderr-1), [`subprocess.stdio`](https://nodejs.org/api/child_process.html#subprocessstdio) and [`subprocess.all`](#all) streams. If the output is read, this should be done right away to avoid missing any data.876+When `buffer` is `false`, the output can still be read using the [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), [`subprocess.stdio`](https://nodejs.org/api/child_process.html#subprocessstdio) and [`subprocess.all`](#subprocessall) streams. If the output is read, this should be done right away to avoid missing any data.877 878-#### input878+#### options.input879 880 Type: `string | Uint8Array | stream.Readable`881 882 Write some input to the subprocess' `stdin`.883 884-See also the [`inputFile`](#inputfile) and [`stdin`](#stdin) options.884+See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.885 886-#### inputFile886+#### options.inputFile887 888 Type: `string | URL`889 890 Use a file as input to the subprocess' `stdin`.891 892-See also the [`input`](#input) and [`stdin`](#stdin) options.892+See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.893 894-#### stdin894+#### options.stdin895 896 Type: `string | number | stream.Readable | ReadableStream | TransformStream | URL | {file: string} | Uint8Array | Iterable<string | Uint8Array | unknown> | AsyncIterable<string | Uint8Array | unknown> | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\897 Default: `inherit` with [`$`](#file-arguments-options), `pipe` otherwise898 13 unmodified lines912 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.913 914 This can also be a generator function, a [`Duplex`](docs/transform.md#duplextransform-streams) or a web [`TransformStream`](docs/transform.md#duplextransform-streams) to transform the input. [Learn more.](docs/transform.md)915 916-#### stdout916+#### options.stdout917 918 Type: `string | number | stream.Writable | WritableStream | TransformStream | URL | {file: string} | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\919 Default: `pipe`920 921 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the subprocess' standard output. This can be:922-- `'pipe'`: Sets [`subprocessResult.stdout`](#stdout) (as a string or `Uint8Array`) and [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).922+- `'pipe'`: Sets [`result.stdout`](#resultstdout) (as a string or `Uint8Array`) and [`subprocess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).923 - `'overlapped'`: Like `'pipe'` but asynchronous on Windows.924 - `'ignore'`: Do not use `stdout`.925 - `'inherit'`: Re-use the current process' `stdout`.926 - an integer: Re-use a specific file descriptor from the current process.5 unmodified lines932 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.933 934 This can also be a generator function, a [`Duplex`](docs/transform.md#duplextransform-streams) or a web [`TransformStream`](docs/transform.md#duplextransform-streams) to transform the output. [Learn more.](docs/transform.md)935 936-#### stderr936+#### options.stderr937 938 Type: `string | number | stream.Writable | WritableStream | TransformStream | URL | {file: string} | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}` (or a tuple of those types)\939 Default: `pipe`940 941 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the subprocess' standard error. This can be:942-- `'pipe'`: Sets [`subprocessResult.stderr`](#stderr) (as a string or `Uint8Array`) and [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).942+- `'pipe'`: Sets [`result.stderr`](#resultstderr) (as a string or `Uint8Array`) and [`subprocess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).943 - `'overlapped'`: Like `'pipe'` but asynchronous on Windows.944 - `'ignore'`: Do not use `stderr`.945 - `'inherit'`: Re-use the current process' `stderr`.946 - an integer: Re-use a specific file descriptor from the current process.5 unmodified lines952 This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.953 954 This can also be a generator function, a [`Duplex`](docs/transform.md#duplextransform-streams) or a web [`TransformStream`](docs/transform.md#duplextransform-streams) to transform the output. [Learn more.](docs/transform.md)955 956-#### stdio956+#### options.stdio957 958 Type: `string | Array<string | number | stream.Readable | stream.Writable | ReadableStream | WritableStream | TransformStream | URL | {file: string} | Uint8Array | Iterable<string> | Iterable<Uint8Array> | Iterable<unknown> | AsyncIterable<string | Uint8Array | unknown> | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}>` (or a tuple of those types)\959 Default: `pipe`960 961-Like the [`stdin`](#stdin), [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options but for all file descriptors at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.961+Like the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options but for all file descriptors at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.962 963 A single string can be used as a shortcut. For example, `{stdio: 'pipe'}` is the same as `{stdin: 'pipe', stdout: 'pipe', stderr: 'pipe'}`.964 965 The array can have more than 3 items, to create additional file descriptors beyond `stdin`/`stdout`/`stderr`. For example, `{stdio: ['pipe', 'pipe', 'pipe', 'pipe']}` sets a fourth file descriptor.966 967-#### all967+#### options.all968 969 Type: `boolean`\970 Default: `false`971 972-Add an `.all` property on the [promise](#all) and the [resolved value](#all-1). The property contains the output of the subprocess with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).972+Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property. They contain the combined/[interleaved](#ensuring-all-output-is-interleaved) output of the subprocess' `stdout` and `stderr`.973 974-#### lines974+#### options.lines975 976 Type: `boolean`\977 Default: `false`978 979-Set [`result.stdout`](#stdout), [`result.stderr`](#stderr), [`result.all`](#all-1) and [`result.stdio`](#stdio) as arrays of strings, splitting the subprocess' output into lines.979+Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.980 981-This cannot be used if the [`encoding` option](#encoding) is binary.981+This cannot be used if the [`encoding`](#optionsencoding) option is binary.982 983-#### encoding983+#### options.encoding984 985 Type: `string`\986 Default: `'utf8'`987 2 unmodified lines990 If it outputs binary data instead, this should be either:991 - `'buffer'`: returns the binary output as an `Uint8Array`.992 - `'hex'`, `'base64'`, `'base64url'`, [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.993 994-The output is available with [`result.stdout`](#stdout), [`result.stderr`](#stderr) and [`result.stdio`](#stdio).994+The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).995 996-#### stripFinalNewline996+#### options.stripFinalNewline997 998 Type: `boolean`\999 Default: `true`1000 1001 Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.1002 1003-If the [`lines` option](#lines) is true, this applies to each output line instead.1003+If the [`lines`](#optionslines) option is true, this applies to each output line instead.1004 1005-#### maxBuffer1005+#### options.maxBuffer1006 1007 Type: `number`\1008 Default: `100_000_000`1009 1010-Largest amount of data allowed on [`stdout`](#stdout), [`stderr`](#stderr) and [`stdio`](#stdio).1010+Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).1011 1012-When this threshold is hit, the subprocess fails and [`error.isMaxBuffer`](#ismaxbuffer) becomes `true`.1012+When this threshold is hit, the subprocess fails and [`error.isMaxBuffer`](#resultismaxbuffer) becomes `true`.1013 1014 This is measured:1015 - By default: in [characters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length).1016-- If the [`encoding` option](#encoding) is `'buffer'`: in bytes.1017-- If the [`lines` option](#lines) is `true`: in lines.1016+- If the [`encoding`](#optionsencoding) option is `'buffer'`: in bytes.1017+- If the [`lines`](#optionslines) option is `true`: in lines.1018 - If a [transform in object mode](docs/transform.md#object-mode) is used: in objects.1019 1020 By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](#options).1021 1022-#### ipc1022+#### options.ipc1023 1024 Type: `boolean`\1025-Default: `true` if the [`node`](#node) option is enabled, `false` otherwise1025+Default: `true` if the [`node`](#optionsnode) option is enabled, `false` otherwise1026 1027 Enables exchanging messages with the subprocess using [`subprocess.send(value)`](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback) and [`subprocess.on('message', (value) => {})`](https://nodejs.org/api/child_process.html#event-message).1028 1029-#### serialization1029+#### options.serialization1030 1031 Type: `string`\1032 Default: `'advanced'`1033 1034-Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#ipc) option:1034+Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option:1035 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.1036 - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)1037 1038 [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)1039 1040-#### detached1040+#### options.detached1041 1042 Type: `boolean`\1043 Default: `false`1044 1045 Prepare subprocess to run independently of the current process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).1046 1047-#### cleanup1047+#### options.cleanup1048 1049 Type: `boolean`\1050 Default: `true`1051 1052 Kill the subprocess when the current process exits unless either:1053 - the subprocess is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)1054 - the current process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit1055 1056-#### timeout1056+#### options.timeout1057 1058 Type: `number`\1059 Default: `0`1060 1061-If `timeout` is greater than `0`, the subprocess will be [terminated](#killsignal) if it runs for longer than that amount of milliseconds.1061+If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.1062 1063-#### cancelSignal1063+#### options.cancelSignal1064 1065 Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)1066 1067 You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).1068 1069-When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `true`.1069+When `AbortController.abort()` is called, [`result.isCanceled`](#resultiscanceled) becomes `true`.1070 1071-#### forceKillAfterDelay1071+#### options.forceKillAfterDelay1072 1073 Type: `number | false`\1074 Default: `5000`1075 1 unmodified line1077 1078 The grace period is 5 seconds by default. This feature can be disabled with `false`.1079 1080 This works when the subprocess is terminated by either:1081-- the [`cancelSignal`](#cancelsignal), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option1081+- the [`cancelSignal`](#optionscancelsignal), [`timeout`](#optionstimeout), [`maxBuffer`](#optionsmaxbuffer) or [`cleanup`](#optionscleanup) option1082 - calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments1083 1084 This does not work when the subprocess is terminated by either:1085 - calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with an argument1 unmodified line1087 - sending a termination signal from another process1088 1089 Also, this does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events): `SIGKILL` and `SIGTERM` both terminate the subprocess immediately. Other packages (such as [`taskkill`](https://github.com/sindresorhus/taskkill)) can be used to achieve fail-safe termination on Windows.1090 1091-#### killSignal1091+#### options.killSignal1092 1093 Type: `string | number`\1094 Default: `SIGTERM`1095 1096 Signal used to terminate the subprocess when:1097-- using the [`cancelSignal`](#cancelsignal), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option1097+- using the [`cancelSignal`](#optionscancelsignal), [`timeout`](#optionstimeout), [`maxBuffer`](#optionsmaxbuffer) or [`cleanup`](#optionscleanup) option1098 - calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments1099 1100 This can be either a name (like `"SIGTERM"`) or a number (like `9`).1101 1102-#### argv01102+#### options.argv01103 1104 Type: `string`1105 1106 Explicitly set the value of `argv[0]` sent to the subprocess. This will be set to `file` if not specified.1107 1108-#### uid1108+#### options.uid1109 1110 Type: `number`1111 1112 Sets the user identity of the subprocess.1113 1114-#### gid1114+#### options.gid1115 1116 Type: `number`1117 1118 Sets the group identity of the subprocess.1119 1120-#### windowsVerbatimArguments1120+#### options.windowsVerbatimArguments1121 1122 Type: `boolean`\1123 Default: `false`1124 1125 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`.1126 1127-#### windowsHide1127+#### options.windowsHide1128 1129 Type: `boolean`\1130 Default: `true`1131 2 unmodified lines1134 ## Tips1135 1136 ### Redirect stdin/stdout/stderr to multiple destinations1137 1138-The [`stdin`](#stdin), [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options can be an array of values.1138+The [`stdin`](#optionsstdin), [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options can be an array of values.1139 The following example redirects `stdout` to both the terminal and an `output.txt` file, while also retrieving its value programmatically.1140 1141 ```js1142 const {stdout} = await execa('npm', ['install'], {stdout: ['inherit', './output.txt', 'pipe']});3 unmodified lines1146 When combining `inherit` with other values, please note that the subprocess will not be an interactive TTY, even if the current process is one.1147 1148 ### Redirect a Node.js stream from/to stdin/stdout/stderr1149 1150-When passing a Node.js stream to the [`stdin`](#stdin), [`stdout`](#stdout-1) or [`stderr`](#stderr-1) option, Node.js requires that stream to have an underlying file or socket, such as the streams created by the `fs`, `net` or `http` core modules. Otherwise the following error is thrown.1150+When passing a Node.js stream to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout) or [`stderr`](#optionsstderr) option, Node.js requires that stream to have an underlying file or socket, such as the streams created by the `fs`, `net` or `http` core modules. Otherwise the following error is thrown.1151 1152 ```1153 TypeError [ERR_INVALID_ARG_VALUE]: The argument 'stdio' is invalid.1154 ```54 unmodified lines1209 ```1210 1211 ### Ensuring `all` output is interleaved1212 1213-The `all` [stream](#all) and [string/`Uint8Array`](#all-1) properties are guaranteed to interleave [`stdout`](#stdout) and [`stderr`](#stderr).1213+The `subprocess.all` [stream](#subprocessall) and `result.all` [string/`Uint8Array`](#resultall) property are guaranteed to interleave [`stdout`](#resultstdout) and [`stderr`](#resultstderr).1214 1215 However, for performance reasons, the subprocess might buffer and merge multiple simultaneous writes to `stdout` or `stderr`. This prevents proper interleaving.1216 1217 For example, this prints `1 3 2` instead of `1 2 3` because both `console.log()` are merged into a single write.35 unmodified lines