Re-order sections in API reference (#994)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent 8b92f47 · Browse files · 4 files·+351 added−351 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+351 added−351 removed
- other:+351 added−351 removed
Provenance
- Commit
ceb1069- Tree
8a10e3e- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
8b92f47
4 files changed+351 added−351 removed
modified:types/arguments/options.d.ts+123 added-123 removed
25 unmodified lines26 */27 readonly node?: boolean;28 29 /**30+ List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.31+32+ Requires the `node` option to be `true`.33+34+ @default [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)35+ */36+ readonly nodeOptions?: readonly string[];37+38+ /**39 Path to the Node.js executable.40 41 Requires the `node` option to be `true`.42 1 unmodified line44 */45 readonly nodePath?: string | URL;46 47 /**39- List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.48+ If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).49 41- Requires the `node` option to be `true`.50+ Uses [`/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.51 43- @default [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)52+ We recommend against using this option.53+54+ @default false55 */45- readonly nodeOptions?: readonly string[];56+ readonly shell?: boolean | string | URL;57 58 /**59+ Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.60+61+ This is also used to resolve the `nodePath` option when it is a relative path.62+63+ @default process.cwd()64+ */65+ readonly cwd?: string | URL;66+67+ /**68+ [Environment variables](https://en.wikipedia.org/wiki/Environment_variable).69+70+ Unless the `extendEnv` option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).71+72+ @default [process.env](https://nodejs.org/api/process.html#processenv)73+ */74+ readonly env?: NodeJS.ProcessEnv;75+76+ /**77+ If `true`, the subprocess uses both the `env` option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).78+ If `false`, only the `env` option is used, not `process.env`.79+80+ @default true81+ */82+ readonly extendEnv?: boolean;83+84+ /**85 Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).86 87 See also the `inputFile` and `stdin` options.88 */44 unmodified lines133 */134 readonly stdio?: StdioOptionsProperty<IsSync>;135 136 /**137+ Add a `subprocess.all` stream and a `result.all` property. They contain the combined/interleaved output of the subprocess' `stdout` and `stderr`.138+139+ @default false140+ */141+ readonly all?: boolean;142+143+ /**144+ If 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).145+146+ If it outputs binary data instead, this should be either:147+ - `'buffer'`: returns the binary output as an `Uint8Array`.148+ - [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'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.149+150+ The output is available with `result.stdout`, `result.stderr` and `result.stdio`.151+152+ @default 'utf8'153+ */154+ readonly encoding?: EncodingOption;155+156+ /**157 Set `result.stdout`, `result.stderr`, `result.all` and `result.stdio` as arrays of strings, splitting the subprocess' output into lines.158 159 This cannot be used if the `encoding` option is binary.160 3 unmodified lines164 */165 readonly lines?: FdGenericOption<boolean>;166 167 /**111- Setting this to `false` resolves the result's promise with the error instead of rejecting it.112-113- @default true114- */115- readonly reject?: boolean;116-117- /**168 Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.169 170 If the `lines` option is true, this applies to each output line instead.171 3 unmodified lines175 */176 readonly stripFinalNewline?: FdGenericOption<boolean>;177 178 /**129- If `true`, the subprocess uses both the `env` option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).130- If `false`, only the `env` option is used, not `process.env`.179+ Largest amount of data allowed on `stdout`, `stderr` and `stdio`.180 132- @default true133- */134- readonly extendEnv?: boolean;181+ By default, this applies to both `stdout` and `stderr`, but different values can also be passed.182 136- /**137- Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.138-139- This is also used to resolve the `nodePath` option when it is a relative path.140-141- @default process.cwd()183+ @default 100_000_000184 */143- readonly cwd?: string | URL;185+ readonly maxBuffer?: FdGenericOption<number>;186 187 /**146- [Environment variables](https://en.wikipedia.org/wiki/Environment_variable).188+ When `buffer` is `false`, the `result.stdout`, `result.stderr`, `result.all` and `result.stdio` properties are not set.189 148- Unless the `extendEnv` option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).190+ By default, this applies to both `stdout` and `stderr`, but different values can also be passed.191 150- @default [process.env](https://nodejs.org/api/process.html#processenv)192+ @default true193 */152- readonly env?: NodeJS.ProcessEnv;194+ readonly buffer?: FdGenericOption<boolean>;195 196 /**155- Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.197+ Enables exchanging messages with the subprocess using `subprocess.send(message)` and `subprocess.on('message', (message) => {})`.198 157- @default file being executed199+ @default `true` if the `node` option is enabled, `false` otherwise200 */159- readonly argv0?: string;201+ readonly ipc?: Unless<IsSync, boolean>;202 203 /**162- Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.204+ Specify the kind of serialization used for sending messages between subprocesses when using the `ipc` option.205 164- @default current user identifier206+ @default 'advanced'207 */166- readonly uid?: number;208+ readonly serialization?: Unless<IsSync, 'json' | 'advanced'>;209 210 /**169- Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.211+ If `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.212 171- @default current group identifier172- */173- readonly gid?: number;213+ If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) and `stderr` are also printed.214 175- /**176- If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).215+ By default, this applies to both `stdout` and `stderr`, but different values can also be passed.216 178- Uses [`/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.179-180- We recommend against using this option.181-182- @default false217+ @default 'none'218 */184- readonly shell?: boolean | string | URL;219+ readonly verbose?: FdGenericOption<'none' | 'short' | 'full'>;220 221 /**187- If 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).222+ Setting this to `false` resolves the result's promise with the error instead of rejecting it.223 189- If it outputs binary data instead, this should be either:190- - `'buffer'`: returns the binary output as an `Uint8Array`.191- - [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'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.192-193- The output is available with `result.stdout`, `result.stderr` and `result.stdio`.194-195- @default 'utf8'224+ @default true225 */197- readonly encoding?: EncodingOption;226+ readonly reject?: boolean;227 228 /**229 If `timeout` is greater than `0`, the subprocess will be terminated if it runs for longer than that amount of milliseconds.230 3 unmodified lines234 */235 readonly timeout?: number;236 237 /**209- Largest amount of data allowed on `stdout`, `stderr` and `stdio`.238+ You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).239 211- By default, this applies to both `stdout` and `stderr`, but different values can also be passed.240+ When `AbortController.abort()` is called, `result.isCanceled` becomes `true`.241 213- @default 100_000_000214- */215- readonly maxBuffer?: FdGenericOption<number>;242+ @example243+ ```244+ import {execa} from 'execa';245 217- /**218- Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.246+ const abortController = new AbortController();247+ const subprocess = execa('node', [], {cancelSignal: abortController.signal});248 220- This can be either a name (like `'SIGTERM'`) or a number (like `9`).249+ setTimeout(() => {250+ abortController.abort();251+ }, 1000);252 222- @default 'SIGTERM'253+ try {254+ await subprocess;255+ } catch (error) {256+ console.log(error.isTerminated); // true257+ console.log(error.isCanceled); // true258+ }259+ ```260 */224- readonly killSignal?: string | number;261+ readonly cancelSignal?: Unless<IsSync, AbortSignal>;262 263 /**264 If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).265 1 unmodified line267 */268 readonly forceKillAfterDelay?: Unless<IsSync, number | false>;269 270 /**234- If `false`, escapes the command arguments on Windows.271+ Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.272 236- @default `true` if the `shell` option is `true`, `false` otherwise237- */238- readonly windowsVerbatimArguments?: boolean;273+ This can be either a name (like `'SIGTERM'`) or a number (like `9`).274 240- /**241- On Windows, do not create a new console window.242-243- @default true275+ @default 'SIGTERM'276 */245- readonly windowsHide?: boolean;277+ readonly killSignal?: string | number;278 279 /**248- If `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.280+ Run the subprocess independently from the current process.281 250- If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) and `stderr` are also printed.251-252- By default, this applies to both `stdout` and `stderr`, but different values can also be passed.253-254- @default 'none'282+ @default false283 */256- readonly verbose?: FdGenericOption<'none' | 'short' | 'full'>;284+ readonly detached?: Unless<IsSync, boolean>;285 286 /**287 Kill the subprocess when the current process exits.288 1 unmodified line290 */291 readonly cleanup?: Unless<IsSync, boolean>;292 293 /**266- When `buffer` is `false`, the `result.stdout`, `result.stderr`, `result.all` and `result.stdio` properties are not set.294+ Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.295 268- By default, this applies to both `stdout` and `stderr`, but different values can also be passed.269-270- @default true296+ @default current user identifier297 */272- readonly buffer?: FdGenericOption<boolean>;298+ readonly uid?: number;299 300 /**275- Add a `subprocess.all` stream and a `result.all` property. They contain the combined/interleaved output of the subprocess' `stdout` and `stderr`.301+ Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.302 277- @default false303+ @default current group identifier304 */279- readonly all?: boolean;305+ readonly gid?: number;306 307 /**282- Enables exchanging messages with the subprocess using `subprocess.send(message)` and `subprocess.on('message', (message) => {})`.308+ Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.309 284- @default `true` if the `node` option is enabled, `false` otherwise310+ @default file being executed311 */286- readonly ipc?: Unless<IsSync, boolean>;312+ readonly argv0?: string;313 314 /**289- Specify the kind of serialization used for sending messages between subprocesses when using the `ipc` option.315+ On Windows, do not create a new console window.316 291- @default 'advanced'317+ @default true318 */293- readonly serialization?: Unless<IsSync, 'json' | 'advanced'>;319+ readonly windowsHide?: boolean;320 321 /**296- Run the subprocess independently from the current process.322+ If `false`, escapes the command arguments on Windows.323 298- @default false324+ @default `true` if the `shell` option is `true`, `false` otherwise325 */300- readonly detached?: Unless<IsSync, boolean>;301-302- /**303- You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).304-305- When `AbortController.abort()` is called, `result.isCanceled` becomes `true`.306-307- @example308- ```309- import {execa} from 'execa';310-311- const abortController = new AbortController();312- const subprocess = execa('node', [], {cancelSignal: abortController.signal});313-314- setTimeout(() => {315- abortController.abort();316- }, 1000);317-318- try {319- await subprocess;320- } catch (error) {321- console.log(error.isTerminated); // true322- console.log(error.isCanceled); // true323- }324- ```325- */326- readonly cancelSignal?: Unless<IsSync, AbortSignal>;326+ readonly windowsVerbatimArguments?: boolean;327 };328 329 /**330 Subprocess options.30 unmodified linesmodified:types/return/final-error.d.ts+2 added-2 removed
4 unmodified lines56789911101112131415161725 unmodified lines4 unmodified linesdeclare abstract class CommonError< IsSync extends boolean = boolean, OptionsType extends CommonOptions = CommonOptions,> extends CommonResult<IsSync, OptionsType> { readonly name: NonNullable<CommonResult['name']>; message: NonNullable<CommonResult['message']>; stack: NonNullable<CommonResult['stack']>; shortMessage: NonNullable<CommonResult['shortMessage']>; originalMessage: NonNullable<CommonResult['originalMessage']>; readonly name: NonNullable<CommonResult['name']>; stack: NonNullable<CommonResult['stack']>;}
// `result.*` defined only on failure, i.e. on `error.*`export type ErrorProperties =25 unmodified linesmodified:types/return/result.d.ts+42 added-42 removed
8 unmodified lines9 IsSync extends boolean = boolean,10 OptionsType extends CommonOptions = CommonOptions,11 > {12 /**13- The file and arguments that were run.14- */15- command: string;16-17- /**18- Same as `command` but escaped.19- */20- escapedCommand: string;21-22- /**23- The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.24-25- This is `undefined` when the subprocess could not be spawned or was terminated by a signal.26- */27- exitCode?: number;28-29- /**13 The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).14 15 This is `undefined` if the `stdout` option is set to only `'inherit'`, `'ignore'`, `Writable` or `integer`, or if the `buffer` option is `false`.16 30 unmodified lines47 */48 stdio: ResultStdioArray<OptionsType>;49 50 /**68- Whether the subprocess failed to run.51+ Results of the other subprocesses that were piped into this subprocess.52+53+ This array is initially empty and is populated each time the `subprocess.pipe()` method resolves.54 */70- failed: boolean;55+ pipedFrom: Unless<IsSync, ExecaResult[], []>;56 57 /**73- Whether the subprocess timed out due to the `timeout` option.58+ The file and arguments that were run.59 */75- timedOut: boolean;60+ command: string;61 62 /**78- Whether the subprocess was terminated by a signal (like `SIGTERM`) sent by either:79- - The current process.80- - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).63+ Same as `command` but escaped.64 */82- isTerminated: boolean;65+ escapedCommand: string;66 67 /**85- The name of the signal (like `SIGTERM`) that terminated the subprocess, sent by either:86- - The current process.87- - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).88-89- If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.68+ The current directory in which the command was run.69 */91- signal?: string;70+ cwd: string;71 72 /**94- A human-friendly description of the signal that was used to terminate the subprocess.95-96- 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.73+ Duration of the subprocess, in milliseconds.74 */98- signalDescription?: string;75+ durationMs: number;76 77 /**101- The current directory in which the command was run.78+ Whether the subprocess failed to run.79 */103- cwd: string;80+ failed: boolean;81 82 /**106- Duration of the subprocess, in milliseconds.83+ Whether the subprocess timed out due to the `timeout` option.84 */108- durationMs: number;85+ timedOut: boolean;86 87 /**88 Whether the subprocess was canceled using the `cancelSignal` option.89 */4 unmodified lines94 */95 isMaxBuffer: boolean;96 97 /**121- Results of the other subprocesses that were piped into this subprocess.98+ Whether the subprocess was terminated by a signal (like `SIGTERM`) sent by either:99+ - The current process.100+ - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).101+ */102+ isTerminated: boolean;103 123- This array is initially empty and is populated each time the `subprocess.pipe()` method resolves.104+ /**105+ The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.106+107+ This is `undefined` when the subprocess could not be spawned or was terminated by a signal.108 */125- pipedFrom: Unless<IsSync, ExecaResult[], []>;109+ exitCode?: number;110 111 /**112+ The name of the signal (like `SIGTERM`) that terminated the subprocess, sent by either:113+ - The current process.114+ - Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).115+116+ If a signal terminated the subprocess, this property is defined and included in the error message. Otherwise it is `undefined`.117+ */118+ signal?: string;119+120+ /**121+ A human-friendly description of the signal that was used to terminate the subprocess.122+123+ 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.124+ */125+ signalDescription?: string;126+127+ /**128 Error message when the subprocess failed to run.129 */130 message?: string;131 56 unmodified linesmodified:readme.md+184 added-184 removed
386 unmodified lines387 Just like `execa()`, this can [bind options](docs/execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `execaCommandSync()`.388 389 [More info.](docs/escaping.md#user-defined-input)390 391-### subprocess391+### Subprocess392 393 The return value of all [asynchronous methods](#methods) is both:394 - a `Promise` resolving or rejecting with a subprocess [`result`](#result).395 - a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.396 397 [More info.](docs/execution.md#subprocess)398 399+#### subprocess\[Symbol.asyncIterator\]()400+401+_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)402+403+Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.404+405+[More info.](docs/lines.md#progressive-splitting)406+407+#### subprocess.iterable(readableOptions?)408+409+`readableOptions`: [`ReadableOptions`](#readableoptions)\410+_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)411+412+Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.413+414+[More info.](docs/lines.md#progressive-splitting)415+416 #### subprocess.pipe(file, arguments?, options?)417 418 `file`: `string | URL`\419 `arguments`: `string[]`\160 unmodified lines580 Each array item is `null` if the corresponding [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option is set to [`'inherit'`](docs/output.md#terminal-output), [`'ignore'`](docs/output.md#ignore-output), [`Stream`](docs/streams.md#output) or [`integer`](docs/output.md#terminal-output), or if the [`buffer`](#optionsbuffer) option is `false`.581 582 [More info.](docs/streams.md#manual-streaming)583 567-#### subprocess\[Symbol.asyncIterator\]()568-569-_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)570-571-Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.572-573-[More info.](docs/lines.md#progressive-splitting)574-575-#### subprocess.iterable(readableOptions?)576-577-`readableOptions`: [`ReadableOptions`](#readableoptions)\578-_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)579-580-Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.581-582-[More info.](docs/lines.md#progressive-splitting)583-584 #### subprocess.readable(readableOptions?)585 586 `readableOptions`: [`ReadableOptions`](#readableoptions)\587 _Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream1 unmodified line589 Converts the subprocess to a readable stream.590 591 [More info.](docs/streams.md#converting-a-subprocess-to-a-stream)592 593-#### subprocess.writable(writableOptions?)594-595-`writableOptions`: [`WritableOptions`](#writableoptions)\596-_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream597-598-Converts the subprocess to a writable stream.599-600-[More info.](docs/streams.md#converting-a-subprocess-to-a-stream)601-602-#### subprocess.duplex(duplexOptions?)603-604-`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\605-_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream606-607-Converts the subprocess to a duplex stream.608-609-[More info.](docs/streams.md#converting-a-subprocess-to-a-stream)610-593 ##### readableOptions594 595 Type: `object`596 29 unmodified lines626 If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.627 628 [More info.](docs/lines.md#iterable)629 630+#### subprocess.writable(writableOptions?)631+632+`writableOptions`: [`WritableOptions`](#writableoptions)\633+_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream634+635+Converts the subprocess to a writable stream.636+637+[More info.](docs/streams.md#converting-a-subprocess-to-a-stream)638+639 ##### writableOptions640 641 Type: `object`642 5 unmodified lines648 Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.649 650 [More info.](docs/streams.md#different-file-descriptor)651 652+#### subprocess.duplex(duplexOptions?)653+654+`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\655+_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream656+657+Converts the subprocess to a duplex stream.658+659+[More info.](docs/streams.md#converting-a-subprocess-to-a-stream)660+661 ### Result662 663 Type: `object`664 665 [Result](docs/execution.md#result) of a subprocess execution.666 667 When the subprocess [fails](docs/errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.668 669-#### result.command670-671-Type: `string`672-673-The file and [arguments](docs/input.md#command-arguments) that were run.674-675-[More info.](docs/debugging.md#command)676-677-#### result.escapedCommand678-679-Type: `string`680-681-Same as [`command`](#resultcommand) but escaped.682-683-[More info.](docs/debugging.md#command)684-685-#### result.cwd686-687-Type: `string`688-689-The [current directory](#optionscwd) in which the command was run.690-691-[More info.](docs/environment.md#current-directory)692-693-#### result.durationMs694-695-Type: `number`696-697-Duration of the subprocess, in milliseconds.698-699-[More info.](docs/debugging.md#duration)700-669 #### result.stdout670 671 Type: `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`672 42 unmodified lines715 Items are arrays when their corresponding `stdio` option is a [transform in object mode](docs/transform.md#object-mode).716 717 [More info.](docs/output.md#additional-file-descriptors)718 719+#### result.pipedFrom720+721+Type: [`Array<Result | ExecaError>`](#result)722+723+[Results](#result) of the other subprocesses that were [piped](#pipe-multiple-subprocesses) into this subprocess.724+725+This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.726+727+[More info.](docs/pipe.md#errors)728+729+#### result.command730+731+Type: `string`732+733+The file and [arguments](docs/input.md#command-arguments) that were run.734+735+[More info.](docs/debugging.md#command)736+737+#### result.escapedCommand738+739+Type: `string`740+741+Same as [`command`](#resultcommand) but escaped.742+743+[More info.](docs/debugging.md#command)744+745+#### result.cwd746+747+Type: `string`748+749+The [current directory](#optionscwd) in which the command was run.750+751+[More info.](docs/environment.md#current-directory)752+753+#### result.durationMs754+755+Type: `number`756+757+Duration of the subprocess, in milliseconds.758+759+[More info.](docs/debugging.md#duration)760+761 #### result.failed762 763 Type: `boolean`764 16 unmodified lines781 Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.782 783 [More info.](docs/termination.md#canceling)784 785+#### result.isMaxBuffer786+787+Type: `boolean`788+789+Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.790+791+[More info.](docs/output.md#big-output)792+793 #### result.isTerminated794 795 Type: `boolean`796 2 unmodified lines799 - [Another process](docs/termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).800 801 [More info.](docs/termination.md#signal-name-and-description)802 785-#### result.isMaxBuffer786-787-Type: `boolean`788-789-Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.790-791-[More info.](docs/output.md#big-output)792-803 #### result.exitCode804 805 Type: `number | undefined`806 24 unmodified lines831 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.832 833 [More info.](docs/termination.md#signal-name-and-description)834 825-#### result.pipedFrom826-827-Type: [`Array<Result | ExecaError>`](#result)828-829-[Results](#result) of the other subprocesses that were [piped](#pipe-multiple-subprocesses) into this subprocess.830-831-This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.832-833-[More info.](docs/pipe.md#errors)834-835 ### ExecaError836 ### ExecaSyncError837 838 Type: `Error`43 unmodified lines882 Type: `string | undefined`883 884 Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.885 886-### options886+### Options887 888 Type: `object`889 890 This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).891 892 The following options [can specify different values](docs/output.md#stdoutstderr-specific-options) for [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr): [`verbose`](#optionsverbose), [`lines`](#optionslines), [`stripFinalNewline`](#optionsstripfinalnewline), [`buffer`](#optionsbuffer), [`maxBuffer`](#optionsmaxbuffer).893 894-#### options.reject895-896-Type: `boolean`\897-Default: `true`898-899-Setting this to `false` resolves the [result's promise](#subprocess) with the [error](#execaerror) instead of rejecting it.900-901-[More info.](docs/errors.md#preventing-exceptions)902-903-#### options.shell904-905-Type: `boolean | string | URL`\906-Default: `false`907-908-If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).909-910-Uses [`/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.911-912-We [recommend against](docs/shell.md#avoiding-shells) using this option.913-914-[More info.](docs/shell.md)915-916-#### options.cwd917-918-Type: `string | URL`\919-Default: `process.cwd()`920-921-Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.922-923-This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.924-925-[More info.](docs/environment.md#current-directory)926-927-#### options.env928-929-Type: `object`\930-Default: [`process.env`](https://nodejs.org/api/process.html#processenv)931-932-[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).933-934-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)).935-936-[More info.](docs/input.md#environment-variables)937-938-#### options.extendEnv939-940-Type: `boolean`\941-Default: `true`942-943-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)).944-If `false`, only the `env` option is used, not `process.env`.945-946-[More info.](docs/input.md#environment-variables)947-894 #### options.preferLocal895 896 Type: `boolean`\897 Default: `true` with [`$`](#file-arguments-options), `false` otherwise41 unmodified lines939 Requires the [`node`](#optionsnode) option to be `true`.940 941 [More info.](docs/node.md#nodejs-version)942 997-#### options.verbose943+#### options.shell944 999-Type: `'none' | 'short' | 'full'`\1000-Default: `'none'`945+Type: `boolean | string | URL`\946+Default: `false`947 1002-If `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.948+If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).949 1004-If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) and `stderr` are also printed.950+Uses [`/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.951 1006-By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).952+We [recommend against](docs/shell.md#avoiding-shells) using this option.953 1008-[More info.](docs/debugging.md#verbose-mode)954+[More info.](docs/shell.md)955 1010-#### options.buffer956+#### options.cwd957 958+Type: `string | URL`\959+Default: `process.cwd()`960+961+Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.962+963+This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.964+965+[More info.](docs/environment.md#current-directory)966+967+#### options.env968+969+Type: `object`\970+Default: [`process.env`](https://nodejs.org/api/process.html#processenv)971+972+[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).973+974+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)).975+976+[More info.](docs/input.md#environment-variables)977+978+#### options.extendEnv979+980 Type: `boolean`\981 Default: `true`982 1015-When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.983+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)).984+If `false`, only the `env` option is used, not `process.env`.985 1017-By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).986+[More info.](docs/input.md#environment-variables)987 1019-[More info.](docs/output.md#low-memory)1020-988 #### options.input989 990 Type: `string | Uint8Array | stream.Readable`991 67 unmodified lines1059 Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.1060 1061 [More info.](docs/output.md#interleaved-output)1062 1096-#### options.lines1097-1098-Type: `boolean`\1099-Default: `false`1100-1101-Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.1102-1103-This cannot be used if the [`encoding`](#optionsencoding) option is [binary](docs/binary.md#binary-output).1104-1105-By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).1106-1107-[More info.](docs/lines.md#simple-splitting)1108-1063 #### options.encoding1064 1065 Type: `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\1066 Default: `'utf8'`7 unmodified lines1074 The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).1075 1076 [More info.](docs/binary.md)1077 1078+#### options.lines1079+1080+Type: `boolean`\1081+Default: `false`1082+1083+Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.1084+1085+This cannot be used if the [`encoding`](#optionsencoding) option is [binary](docs/binary.md#binary-output).1086+1087+By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).1088+1089+[More info.](docs/lines.md#simple-splitting)1090+1091 #### options.stripFinalNewline1092 1093 Type: `boolean`\1094 Default: `true`16 unmodified lines1111 By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).1112 1113 [More info.](docs/output.md#big-output)1114 1115+#### options.buffer1116+1117+Type: `boolean`\1118+Default: `true`1119+1120+When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.1121+1122+By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).1123+1124+[More info.](docs/output.md#low-memory)1125+1126 #### options.ipc1127 1128 Type: `boolean`\1129 Default: `true` if the [`node`](#optionsnode) option is enabled, `false` otherwise10 unmodified lines1140 Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.1141 1142 [More info.](docs/ipc.md#message-type)1143 1166-#### options.detached1144+#### options.verbose1145 1168-Type: `boolean`\1169-Default: `false`1146+Type: `'none' | 'short' | 'full'`\1147+Default: `'none'`1148 1171-Run the subprocess independently from the current process.1149+If `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.1150 1173-[More info.](docs/environment.md#background-subprocess)1151+If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) and `stderr` are also printed.1152 1175-#### options.cleanup1153+By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](docs/output.md#stdoutstderr-specific-options).1154 1155+[More info.](docs/debugging.md#verbose-mode)1156+1157+#### options.reject1158+1159 Type: `boolean`\1160 Default: `true`1161 1180-Kill the subprocess when the current process exits.1162+Setting this to `false` resolves the [result's promise](#subprocess) with the [error](#execaerror) instead of rejecting it.1163 1182-[More info.](docs/termination.md#current-process-exit)1164+[More info.](docs/errors.md#preventing-exceptions)1165 1166 #### options.timeout1167 1168 Type: `number`\34 unmodified lines1203 This can be either a name (like [`'SIGTERM'`](docs/termination.md#sigterm)) or a number (like `9`).1204 1205 [More info.](docs/termination.md#default-signal)1206 1225-#### options.argv01207+#### options.detached1208 1227-Type: `string`\1228-Default: file being executed1209+Type: `boolean`\1210+Default: `false`1211 1230-Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.1212+Run the subprocess independently from the current process.1213 1214+[More info.](docs/environment.md#background-subprocess)1215+1216+#### options.cleanup1217+1218+Type: `boolean`\1219+Default: `true`1220+1221+Kill the subprocess when the current process exits.1222+1223+[More info.](docs/termination.md#current-process-exit)1224+1225 #### options.uid1226 1227 Type: `number`\1228 Default: current user identifier10 unmodified lines1239 Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.1240 1241 [More info.](docs/windows.md#uid-and-gid)1242 1250-#### options.windowsVerbatimArguments1243+#### options.argv01244 1252-Type: `boolean`\1253-Default: `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise1245+Type: `string`\1246+Default: file being executed1247 1255-If `false`, escapes the command arguments on Windows.1248+Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.1249 1257-[More info.](docs/windows.md#cmdexe-escaping)1258-1250 #### options.windowsHide1251 1252 Type: `boolean`\1253 Default: `true`1 unmodified line1255 On Windows, do not create a new console window.1256 1257 [More info.](docs/windows.md#console-window)1258 1259+#### options.windowsVerbatimArguments1260+1261+Type: `boolean`\1262+Default: `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise1263+1264+If `false`, escapes the command arguments on Windows.1265+1266+[More info.](docs/windows.md#cmdexe-escaping)1267+1268 ### Transform options1269 1270 A transform or an [array of transforms](docs/transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.1271 56 unmodified lines