Skip to content
Myr

Fix style inconsistency in API reference (#1010)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 2ef9186 · Browse files · 1 file+126 added−126 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+126 added−126 removed

  • other:+126 added−126 removed

1 file+126 added−126 removed

modified:docs/api.md+126 added-126 removed
97 unmodified lines
98[More info.](escaping.md#user-defined-input)99100## Return value101102_Type_: `ResultPromise`102_Type:_ `ResultPromise`103104The return value of all [asynchronous methods](#methods) is both:105- the [subprocess](#subprocess).106- a `Promise` either resolving with its successful [`result`](#result), or rejecting with its [`error`](#execaerror).
1 unmodified line
108[More info.](execution.md#subprocess)109110## Subprocess111112_Type_: `Subprocess`112_Type:_ `Subprocess`113114[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.115116### subprocess\[Symbol.asyncIterator\]()
48 unmodified lines
165[More info.](pipe.md#advanced-syntax)166167#### pipeOptions168169Type: `object`169_Type:_ `object`170171#### pipeOptions.from172173Type: `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\174Default: `"stdout"`173_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\174_Default:_ `"stdout"`175176Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.177178`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.
1 unmodified line
180[More info.](pipe.md#source-file-descriptor)181182#### pipeOptions.to183184Type: `"stdin" | "fd3" | "fd4" | ...`\185Default: `"stdin"`184_Type:_ `"stdin" | "fd3" | "fd4" | ...`\185_Default:_ `"stdin"`186187Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.188189[More info.](pipe.md#destination-file-descriptor)190191#### pipeOptions.unpipeSignal192193Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)193_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)194195Unpipe the subprocess when the signal aborts.196197[More info.](pipe.md#unpipe)
14 unmodified lines
212[More info.](termination.md)213214### subprocess.pid215216_Type_: `number | undefined`216_Type:_ `number | undefined`217218Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).219220This is `undefined` if the subprocess failed to spawn.
26 unmodified lines
247[More info.](ipc.md#exchanging-messages)248249### subprocess.stdin250251Type: [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)251_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)252253The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.254255This is `null` if the [`stdin`](#optionsstdin) option is set to [`'inherit'`](input.md#terminal-input), [`'ignore'`](input.md#ignore-input), [`Readable`](streams.md#input) or [`integer`](input.md#terminal-input).
1 unmodified line
257[More info.](streams.md#manual-streaming)258259### subprocess.stdout260261Type: [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)261_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)262263The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.264265This is `null` if the [`stdout`](#optionsstdout) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
1 unmodified line
267[More info.](streams.md#manual-streaming)268269### subprocess.stderr270271Type: [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)271_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)272273The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.274275This is `null` if the [`stderr`](#optionsstdout) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
1 unmodified line
277[More info.](streams.md#manual-streaming)278279### subprocess.all280281Type: [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)281_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)282283Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).284285This requires the [`all`](#optionsall) option to be `true`.
3 unmodified lines
289More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).290291### subprocess.stdio292293Type: [`[Writable | null, Readable | null, Readable | null, ...Array<Writable | Readable | null>]`](https://nodejs.org/api/stream.html#class-streamreadable)293_Type:_ [`[Writable | null, Readable | null, Readable | null, ...Array<Writable | Readable | null>]`](https://nodejs.org/api/stream.html#class-streamreadable)294295The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.296297Each array item is `null` if the corresponding [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Stream`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
10 unmodified lines
308[More info.](streams.md#converting-a-subprocess-to-a-stream)309310#### readableOptions311312Type: `object`312_Type:_ `object`313314#### readableOptions.from315316Type: `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\317Default: `"stdout"`316_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\317_Default:_ `"stdout"`318319Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.320321`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.
1 unmodified line
323[More info.](streams.md#different-file-descriptor)324325#### readableOptions.binary326327Type: `boolean`\328Default: `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)327_Type:_ `boolean`\328_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)329330If `false`, iterates over lines. Each line is a string.331332If `true`, iterates over arbitrary chunks of data. Each line is an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) (with [`subprocess.iterable()`](#subprocessiterablereadableoptions)) or a [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) (with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)).
3 unmodified lines
336More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).337338#### readableOptions.preserveNewlines339340Type: `boolean`\341Default: `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)340_Type:_ `boolean`\341_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)342343If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.344345[More info.](lines.md#iterable)
8 unmodified lines
354[More info.](streams.md#converting-a-subprocess-to-a-stream)355356#### writableOptions357358Type: `object`358_Type:_ `object`359360#### writableOptions.to361362Type: `"stdin" | "fd3" | "fd4" | ...`\363Default: `"stdin"`362_Type:_ `"stdin" | "fd3" | "fd4" | ...`\363_Default:_ `"stdin"`364365Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.366367[More info.](streams.md#different-file-descriptor)
8 unmodified lines
376[More info.](streams.md#converting-a-subprocess-to-a-stream)377378## Result379380Type: `object`380_Type:_ `object`381382[Result](execution.md#result) of a subprocess successful execution.383384When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.385386### result.stdout387388Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`388_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`389390The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).391392This is `undefined` if the [`stdout`](#optionsstdout) option is set to only [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
3 unmodified lines
396[More info.](output.md#stdout-and-stderr)397398### result.stderr399400Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`400_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`401402The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).403404This is `undefined` if the [`stderr`](#optionsstderr) option is set to only [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
3 unmodified lines
408[More info.](output.md#stdout-and-stderr)409410### result.all411412Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`412_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`413414The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.415416This requires the [`all`](#optionsall) option to be `true`.
5 unmodified lines
422[More info.](output.md#interleaved-output)423424### result.stdio425426Type: `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`426_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`427428The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).429430Items are `undefined` when their corresponding [`stdio`](#optionsstdio) option is set to [`'inherit'`](output.md#terminal-output), [`'ignore'`](output.md#ignore-output), [`Writable`](streams.md#output) or [`integer`](output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.
3 unmodified lines
434[More info.](output.md#additional-file-descriptors)435436### result.pipedFrom437438Type: [`Array<Result | ExecaError>`](#result)438_Type:_ [`Array<Result | ExecaError>`](#result)439440[Results](#result) of the other subprocesses that were piped into this subprocess.441442This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.
1 unmodified line
444[More info.](pipe.md#result)445446### result.command447448Type: `string`448_Type:_ `string`449450The file and [arguments](input.md#command-arguments) that were run.451452[More info.](debugging.md#command)453454### result.escapedCommand455456Type: `string`456_Type:_ `string`457458Same as [`command`](#resultcommand) but escaped.459460[More info.](debugging.md#command)461462### result.cwd463464Type: `string`464_Type:_ `string`465466The [current directory](#optionscwd) in which the command was run.467468[More info.](environment.md#current-directory)469470### result.durationMs471472Type: `number`472_Type:_ `number`473474Duration of the subprocess, in milliseconds.475476[More info.](debugging.md#duration)477478### result.failed479480Type: `boolean`480_Type:_ `boolean`481482Whether the subprocess failed to run.483484When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.
2 unmodified lines
487488## ExecaError489## ExecaSyncError490491Type: `Error`491_Type:_ `Error`492493Result of a subprocess [failed execution](errors.md#subprocess-failure).494495This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.
3 unmodified lines
499[More info.](errors.md)500501### error.message502503Type: `string`503_Type:_ `string`504505Error message when the subprocess [failed](errors.md#subprocess-failure) to run.506507[More info.](errors.md#error-message)508509### error.shortMessage510511Type: `string`511_Type:_ `string`512513This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).514515[More info.](errors.md#error-message)516517### error.originalMessage518519Type: `string | undefined`519_Type:_ `string | undefined`520521Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.522523[More info.](errors.md#error-message)524525### error.cause526527Type: `unknown | undefined`527_Type:_ `unknown | undefined`528529Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).530531This is usually an `Error` instance.
1 unmodified line
533[More info.](termination.md#error-message-and-stack-trace)534535### error.code536537Type: `string | undefined`537_Type:_ `string | undefined`538539Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.540541### error.timedOut542543Type: `boolean`543_Type:_ `boolean`544545Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.546547[More info.](termination.md#timeout)548549### error.isCanceled550551Type: `boolean`551_Type:_ `boolean`552553Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.554555[More info.](termination.md#canceling)556557### error.isMaxBuffer558559Type: `boolean`559_Type:_ `boolean`560561Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.562563[More info.](output.md#big-output)564565### error.isTerminated566567Type: `boolean`567_Type:_ `boolean`568569Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:570- The current process.571- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).
1 unmodified line
573[More info.](termination.md#signal-name-and-description)574575### error.exitCode576577Type: `number | undefined`577_Type:_ `number | undefined`578579The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.580581This is `undefined` when the subprocess could not be spawned or was terminated by a [signal](#errorsignal).
1 unmodified line
583[More info.](errors.md#exit-code)584585### error.signal586587Type: `string | undefined`587_Type:_ `string | undefined`588589The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:590- The current process.591- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).
3 unmodified lines
595[More info.](termination.md#signal-name-and-description)596597### error.signalDescription598599Type: `string | undefined`599_Type:_ `string | undefined`600601A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.602603If 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.
1 unmodified line
605[More info.](termination.md#signal-name-and-description)606607## Options608609Type: `object`609_Type:_ `object`610611This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).612613The following options [can specify different values](output.md#stdoutstderr-specific-options) for [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr): [`verbose`](#optionsverbose), [`lines`](#optionslines), [`stripFinalNewline`](#optionsstripfinalnewline), [`buffer`](#optionsbuffer), [`maxBuffer`](#optionsmaxbuffer).614615### options.preferLocal616617Type: `boolean`\618Default: `true` with [`$`](#file-arguments-options), `false` otherwise617_Type:_ `boolean`\618_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwise619620Prefer locally installed binaries when looking for a binary to execute.621622[More info.](environment.md#local-binaries)623624### options.localDir625626Type: `string | URL`\627Default: [`cwd`](#optionscwd) option626_Type:_ `string | URL`\627_Default:_ [`cwd`](#optionscwd) option628629Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.630631[More info.](environment.md#local-binaries)632633### options.node634635Type: `boolean`\636Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise635_Type:_ `boolean`\636_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise637638If `true`, runs with Node.js. The first argument must be a Node.js file.639640[More info.](node.md)641642### options.nodeOptions643644Type: `string[]`\645Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)644_Type:_ `string[]`\645_Default:_ [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)646647List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).648649Requires the [`node`](#optionsnode) option to be `true`.
1 unmodified line
651[More info.](node.md#nodejs-cli-flags)652653### options.nodePath654655Type: `string | URL`\656Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)655_Type:_ `string | URL`\656_Default:_ [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)657658Path to the Node.js executable.659660Requires the [`node`](#optionsnode) option to be `true`.
1 unmodified line
662[More info.](node.md#nodejs-version)663664### options.shell665666Type: `boolean | string | URL`\667Default: `false`666_Type:_ `boolean | string | URL`\667_Default:_ `false`668669If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).670671Uses [`/bin/sh`](https://en.wikipedia.org/wiki/Unix_shell) on UNIX and [`cmd.exe`](https://en.wikipedia.org/wiki/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.
3 unmodified lines
675[More info.](shell.md)676677### options.cwd678679Type: `string | URL`\680Default: `process.cwd()`679_Type:_ `string | URL`\680_Default:_ `process.cwd()`681682Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.683684This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.
1 unmodified line
686[More info.](environment.md#current-directory)687688### options.env689690Type: `object`\691Default: [`process.env`](https://nodejs.org/api/process.html#processenv)690_Type:_ `object`\691_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)692693[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).694695Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).
1 unmodified line
697[More info.](input.md#environment-variables)698699### options.extendEnv700701Type: `boolean`\702Default: `true`701_Type:_ `boolean`\702_Default:_ `true`703704If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).705If `false`, only the `env` option is used, not `process.env`.706707[More info.](input.md#environment-variables)708709### options.input710711Type: `string | Uint8Array | stream.Readable`711_Type:_ `string | Uint8Array | stream.Readable`712713Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).714715See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.
1 unmodified line
717[More info.](input.md#string-input)718719### options.inputFile720721Type: `string | URL`721_Type:_ `string | URL`722723Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).724725See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.
1 unmodified line
727[More info.](input.md#file-input)728729### options.stdin730731Type: `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)\732Default: `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwise731_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)\732_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwise733734How to setup the subprocess' [standard input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](streams.md#manual-streaming), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](input.md#ignore-input), [`'inherit'`](input.md#terminal-input), a [file descriptor integer](input.md#terminal-input), a [Node.js `Readable` stream](streams.md#input), a web [`ReadableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](input.md#file-input), a [file URL](input.md#file-input), an [`Iterable`](streams.md#iterables-as-input) (including an [array of strings](input.md#string-input)), an [`AsyncIterable`](streams.md#iterables-as-input), an [`Uint8Array`](binary.md#binary-input), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).735736This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
1 unmodified line
738More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).739740### options.stdout741742Type: `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)\743Default: `pipe`742_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)\743_Default:_ `pipe`744745How to setup the subprocess' [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](output.md#stdout-and-stderr), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](output.md#ignore-output), [`'inherit'`](output.md#terminal-output), a [file descriptor integer](output.md#terminal-output), a [Node.js `Writable` stream](streams.md#output), a web [`WritableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](output.md#file-output), a [file URL](output.md#file-output), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).746747This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
1 unmodified line
749More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).750751### options.stderr752753Type: `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)\754Default: `pipe`753_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)\754_Default:_ `pipe`755756How to setup the subprocess' [standard error](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This can be [`'pipe'`](output.md#stdout-and-stderr), [`'overlapped'`](windows.md#asynchronous-io), [`'ignore`](output.md#ignore-output), [`'inherit'`](output.md#terminal-output), a [file descriptor integer](output.md#terminal-output), a [Node.js `Writable` stream](streams.md#output), a web [`WritableStream`](streams.md#web-streams), a [`{ file: 'path' }` object](output.md#file-output), a [file URL](output.md#file-output), a [generator function](transform.md), a [`Duplex`](transform.md#duplextransform-streams) or a web [`TransformStream`](transform.md#duplextransform-streams).757758This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.
1 unmodified line
760More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).761762### options.stdio763764Type: `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)\765Default: `pipe`764_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)\765_Default:_ `pipe`766767Like the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options but for all [file descriptors](https://en.wikipedia.org/wiki/File_descriptor) at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.768769A single string can be used [as a shortcut](output.md#shortcut).
3 unmodified lines
773More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).774775### options.all776777Type: `boolean`\778Default: `false`777_Type:_ `boolean`\778_Default:_ `false`779780Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.781782[More info.](output.md#interleaved-output)783784### options.encoding785786Type: `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\787Default: `'utf8'`786_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\787_Default:_ `'utf8'`788789If the subprocess outputs text, specifies its character encoding, either [`'utf8'`](https://en.wikipedia.org/wiki/UTF-8) or [`'utf16le'`](https://en.wikipedia.org/wiki/UTF-16).790791If it outputs binary data instead, this should be either:
5 unmodified lines
797[More info.](binary.md)798799### options.lines800801Type: `boolean`\802Default: `false`801_Type:_ `boolean`\802_Default:_ `false`803804Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.805806This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).
3 unmodified lines
810[More info.](lines.md#simple-splitting)811812### options.stripFinalNewline813814Type: `boolean`\815Default: `true`814_Type:_ `boolean`\815_Default:_ `true`816817Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.818819If the [`lines`](#optionslines) option is true, this applies to each output line instead.
3 unmodified lines
823[More info.](lines.md#newlines)824825### options.maxBuffer826827Type: `number`\828Default: `100_000_000`827_Type:_ `number`\828_Default:_ `100_000_000`829830Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).831832By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).
1 unmodified line
834[More info.](output.md#big-output)835836### options.buffer837838Type: `boolean`\839Default: `true`838_Type:_ `boolean`\839_Default:_ `true`840841When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.842843By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).
1 unmodified line
845[More info.](output.md#low-memory)846847### options.ipc848849Type: `boolean`\850Default: `true` if the [`node`](#optionsnode) option is enabled, `false` otherwise849_Type:_ `boolean`\850_Default:_ `true` if the [`node`](#optionsnode) option is enabled, `false` otherwise851852Enables exchanging messages with the subprocess using [`subprocess.send(message)`](#subprocesssendmessage) and [`subprocess.on('message', (message) => {})`](#subprocessonmessage-message--void).853854[More info.](ipc.md)855856### options.serialization857858Type: `'json' | 'advanced'`\859Default: `'advanced'`858_Type:_ `'json' | 'advanced'`\859_Default:_ `'advanced'`860861Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.862863[More info.](ipc.md#message-type)864865### options.verbose866867Type: `'none' | 'short' | 'full'`\868Default: `'none'`867_Type:_ `'none' | 'short' | 'full'`\868_Default:_ `'none'`869870If `verbose` is `'short'`, prints the command on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)): its file, arguments, duration and (if it failed) error message.871872If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) and `stderr` are also printed.
3 unmodified lines
876[More info.](debugging.md#verbose-mode)877878### options.reject879880Type: `boolean`\881Default: `true`880_Type:_ `boolean`\881_Default:_ `true`882883Setting this to `false` resolves the [result's promise](#return-value) with the [error](#execaerror) instead of rejecting it.884885[More info.](errors.md#preventing-exceptions)886887### options.timeout888889Type: `number`\890Default: `0`889_Type:_ `number`\890_Default:_ `0`891892If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.893894On timeout, [`result.timedOut`](#errortimedout) becomes `true`.
1 unmodified line
896[More info.](termination.md#timeout)897898### options.cancelSignal899900Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)900_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)901902You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).903904When `AbortController.abort()` is called, [`result.isCanceled`](#erroriscanceled) becomes `true`.
1 unmodified line
906[More info.](termination.md#canceling)907908### options.forceKillAfterDelay909910Type: `number | false`\911Default: `5000`910_Type:_ `number | false`\911_Default:_ `5000`912913If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).914915[More info.](termination.md#forceful-termination)916917### options.killSignal918919Type: `string | number`\920Default: `'SIGTERM'`919_Type:_ `string | number`\920_Default:_ `'SIGTERM'`921922Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.923924This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).
1 unmodified line
926[More info.](termination.md#default-signal)927928### options.detached929930Type: `boolean`\931Default: `false`930_Type:_ `boolean`\931_Default:_ `false`932933Run the subprocess independently from the current process.934935[More info.](environment.md#background-subprocess)936937### options.cleanup938939Type: `boolean`\940Default: `true`939_Type:_ `boolean`\940_Default:_ `true`941942Kill the subprocess when the current process exits.943944[More info.](termination.md#current-process-exit)945946### options.uid947948Type: `number`\949Default: current user identifier948_Type:_ `number`\949_Default:_ current user identifier950951Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.952953[More info.](windows.md#uid-and-gid)954955### options.gid956957Type: `number`\958Default: current group identifier957_Type:_ `number`\958_Default:_ current group identifier959960Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.961962[More info.](windows.md#uid-and-gid)963964### options.argv0965966Type: `string`\967Default: file being executed966_Type:_ `string`\967_Default:_ file being executed968969Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.970971### options.windowsHide972973Type: `boolean`\974Default: `true`973_Type:_ `boolean`\974_Default:_ `true`975976On Windows, do not create a new console window.977978[More info.](windows.md#console-window)979980### options.windowsVerbatimArguments981982Type: `boolean`\983Default: `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise982_Type:_ `boolean`\983_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise984985If `false`, escapes the command arguments on Windows.986987[More info.](windows.md#cmdexe-escaping)
7 unmodified lines
995[More info.](transform.md)996997### transformOptions.transform998999Type: `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`999_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`10001001Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.10021003More info [here](transform.md#summary) and [there](transform.md#sharing-state).10041005### transformOptions.final10061007Type: `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`1007_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`10081009Create additional lines after the last one.10101011[More info.](transform.md#finalizing)10121013### transformOptions.binary10141015Type: `boolean`\1016Default: `false`1015_Type:_ `boolean`\1016_Default:_ `false`10171018If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.10191020[More info.](binary.md#transforms)10211022### transformOptions.preserveNewlines10231024Type: `boolean`\1025Default: `false`1024_Type:_ `boolean`\1025_Default:_ `false`10261027If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.10281029[More info.](lines.md#transforms)10301031### transformOptions.objectMode10321033Type: `boolean`\1034Default: `false`1033_Type:_ `boolean`\1034_Default:_ `false`10351036If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.10371038[More info.](transform.md#object-mode)
5 unmodified lines