Skip to content
Myr

api.md

This file

Path

docs/api.md

1,144 lines · 45.4 KiB · Markdown

Last changed by

Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6

History of this file

Take it

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1–17why, one step back
1<picture>
2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 📔 API reference89This lists all available [methods](#methods) and their [options](#options). This also describes the properties of the [subprocess](#subprocess), [result](#result) and [error](#execaerror) they return.1011## Methods1213### execa(file, arguments?, options?)1415`file`: `string | URL`\16`arguments`: `string[]`\17`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 18why, one step back
18_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 19–28why, one step back
19
20Executes a command using `file ...arguments`.2122More info on the [syntax](execution.md#array-syntax) and [escaping](escaping.md#array-syntax).2324### execa\`command\`25### execa(options)\`command\`2627`command`: `string`\28`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 29why, one step back
29_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 30–46why, one step back
30
31Executes a command. `command` is a [template string](execution.md#template-string-syntax) that includes both the `file` and its `arguments`.3233More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).3435### execa(options)3637`options`: [`Options`](#options)\38_Returns_: [`execa`](#execafile-arguments-options)3940Returns a new instance of Execa but with different default [`options`](#options). Consecutive calls are merged to previous ones.4142[More info.](execution.md#globalshared-options)4344### execaSync(file, arguments?, options?)45### execaSync\`command\`46

Rename some types (#1009)ehmickybefore adoption2ef9186

line 47why, one step back
47_Returns_: [`SyncResult`](#return-value)

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 48why, one step back
48

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 49–59why, one step back
49Same as [`execa()`](#execafile-arguments-options) but synchronous.
5051Returns or throws a subprocess [`result`](#result). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.5253[More info.](execution.md#synchronous-execution)5455### $(file, arguments?, options?)5657`file`: `string | URL`\58`arguments`: `string[]`\59`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 60why, one step back
60_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 61–74why, one step back
61
62Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).6364Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `$.sync()` or `$.s()`.6566This is the preferred method when executing multiple commands in a script file.6768[More info.](scripts.md)6970### execaNode(scriptPath, arguments?, options?)7172`scriptPath`: `string | URL`\73`arguments`: `string[]`\74`options`: [`Options`](#options)\

Rename some types (#1009)ehmickybefore adoption2ef9186

line 75why, one step back
75_Returns_: [`ResultPromise`](#return-value)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 76–85why, one step back
76
77Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.78Executes a Node.js file using `node scriptPath ...arguments`.7980Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options).8182This is the preferred method when executing Node.js files.8384[More info.](node.md)85

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 86why, one step back
86### parseCommandString(command)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 87–88why, one step back
87
88`command`: `string`\

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 89why, one step back
89_Returns_: `string[]`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 90why, one step back
90

Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3

line 91why, one step back
91Split a `command` string into an array. For example, `'npm run build'` returns `['npm', 'run', 'build']` and `'argument otherArgument'` returns `['argument', 'otherArgument']`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 92–94why, one step back
92
93[More info.](escaping.md#user-defined-input)94

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 95–105why, one step back
95### sendMessage(message)
9697`message`: [`Message`](ipc.md#message-type)\98_Returns_: `Promise<void>`99100Send a `message` to the parent process.101102This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.103104[More info.](ipc.md#exchanging-messages)105

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 106why, one step back
106### getOneMessage(getOneMessageOptions?)

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 107why, one step back
107

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 108why, one step back
108_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 109–116why, one step back
109_Returns_: [`Promise<Message>`](ipc.md#message-type)
110111Receive a single `message` from the parent process.112113This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.114115[More info.](ipc.md#exchanging-messages)116

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

lines 117–128why, one step back
117#### getOneMessageOptions
118119_Type_: `object`120121#### getOneMessageOptions.filter122123_Type_: [`(Message) => boolean`](ipc.md#message-type)124125Ignore any `message` that returns `false`.126127[More info.](ipc.md#filter-messages)128

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 129–138why, one step back
129### getEachMessage()
130131_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)132133Iterate over each `message` from the parent process.134135This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.136137[More info.](ipc.md#listening-to-messages)138

Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6

lines 139–150why, one step back
139### exchangeMessage(message, getOneMessageOptions?)
140141`message`: [`Message`](ipc.md#message-type)\142_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\143_Returns_: [`Promise<Message>`](ipc.md#message-type)144145Send a `message` to the parent process, then receive a response from it.146147This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.148149[More info.](ipc.md#exchanging-messages)150

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 151why, one step back
151## Return value

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 152why, one step back
152

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

lines 153–154why, one step back
153_TypeScript:_ [`ResultPromise`](typescript.md)\
154_Type:_ `Promise<object> | Subprocess`

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 155why, one step back
155

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 156why, one step back
156The return value of all [asynchronous methods](#methods) is both:

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 157–158why, one step back
157- the [subprocess](#subprocess).
158- a `Promise` either resolving with its successful [`result`](#result), or rejecting with its [`error`](#execaerror).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 159–161why, one step back
159
160[More info.](execution.md#subprocess)161

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 162–163why, one step back
162## Subprocess
163

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 164why, one step back
164_TypeScript:_ [`Subprocess`](typescript.md)

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

lines 165–167why, one step back
165
166[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.167

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 168–210why, one step back
168### subprocess\[Symbol.asyncIterator\]()
169170_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)171172Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.173174[More info.](lines.md#progressive-splitting)175176### subprocess.iterable(readableOptions?)177178`readableOptions`: [`ReadableOptions`](#readableoptions)\179_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)180181Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.182183[More info.](lines.md#progressive-splitting)184185### subprocess.pipe(file, arguments?, options?)186187`file`: `string | URL`\188`arguments`: `string[]`\189`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\190_Returns_: [`Promise<Result>`](#result)191192[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the subprocess' [`stdout`](#subprocessstdout) to a second Execa subprocess' [`stdin`](#subprocessstdin). This resolves with that second subprocess' [result](#result). If either subprocess is rejected, this is rejected with that subprocess' [error](#execaerror) instead.193194This 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.195196[More info.](pipe.md#array-syntax)197198### subprocess.pipe\`command\`199### subprocess.pipe(options)\`command\`200201`command`: `string`\202`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\203_Returns_: [`Promise<Result>`](#result)204205Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using a [`command` template string](scripts.md#piping-stdout-to-another-command) instead. This follows the same syntax as `execa` [template strings](execution.md#template-string-syntax).206207[More info.](pipe.md#template-string-syntax)208209### subprocess.pipe(secondSubprocess, pipeOptions?)210

Rename some types (#1009)ehmickybefore adoption2ef9186

line 211why, one step back
211`secondSubprocess`: [`ResultPromise`](#return-value)\

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 212–214why, one step back
212`pipeOptions`: [`PipeOptions`](#pipeoptions)\
213_Returns_: [`Promise<Result>`](#result)214

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 215why, one step back
215Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using the [return value](#return-value) of another [`execa()`](#execafile-arguments-options) call instead.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 216–220why, one step back
216
217[More info.](pipe.md#advanced-syntax)218219#### pipeOptions220

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 221why, one step back
221_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 222–224why, one step back
222
223#### pipeOptions.from224

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 225–226why, one step back
225_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\
226_Default:_ `"stdout"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 227–235why, one step back
227
228Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.229230`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.231232[More info.](pipe.md#source-file-descriptor)233234#### pipeOptions.to235

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 236–237why, one step back
236_Type:_ `"stdin" | "fd3" | "fd4" | ...`\
237_Default:_ `"stdin"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 238–244why, one step back
238
239Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.240241[More info.](pipe.md#destination-file-descriptor)242243#### pipeOptions.unpipeSignal244

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 245why, one step back
245_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 246–257why, one step back
246
247Unpipe the subprocess when the signal aborts.248249[More info.](pipe.md#unpipe)250251### subprocess.kill(signal, error?)252### subprocess.kill(error?)253254`signal`: `string | number`\255`error`: `Error`\256_Returns_: `boolean`257

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 258why, one step back
258Sends 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](#erroristerminated) the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 259–267why, one step back
259
260This returns `false` when the signal could not be sent, for example when the subprocess has already exited.261262When 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).263264[More info.](termination.md)265266### subprocess.pid267

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 268why, one step back
268_Type:_ `number | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 269–275why, one step back
269
270Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).271272This is `undefined` if the subprocess failed to spawn.273274[More info.](termination.md#inter-process-termination)275

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 276why, one step back
276### subprocess.sendMessage(message)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 277why, one step back
277

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 278–279why, one step back
278`message`: [`Message`](ipc.md#message-type)\
279_Returns_: `Promise<void>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 280why, one step back
280

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 281why, one step back
281Send a `message` to the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 282why, one step back
282

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 283why, one step back
283This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 284–286why, one step back
284
285[More info.](ipc.md#exchanging-messages)286

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 287why, one step back
287### subprocess.getOneMessage(getOneMessageOptions?)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 288why, one step back
288

Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052

line 289why, one step back
289_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 290why, one step back
290_Returns_: [`Promise<Message>`](ipc.md#message-type)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 291why, one step back
291

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 292why, one step back
292Receive a single `message` from the subprocess.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 293why, one step back
293

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 294why, one step back
294This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 295–297why, one step back
295
296[More info.](ipc.md#exchanging-messages)297

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 298–307why, one step back
298### subprocess.getEachMessage()
299300_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)301302Iterate over each `message` from the subprocess.303304This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.305306[More info.](ipc.md#listening-to-messages)307

Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6

lines 308–319why, one step back
308### subprocess.exchangeMessage(message, getOneMessageOptions?)
309310`message`: [`Message`](ipc.md#message-type)\311_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\312_Returns_: [`Promise<Message>`](ipc.md#message-type)313314Send a `message` to the subprocess, then receive a response from it.315316This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.317318[More info.](ipc.md#exchanging-messages)319

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 320–321why, one step back
320### subprocess.stdin
321

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 322why, one step back
322_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 323–331why, one step back
323
324The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.325326This 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).327328[More info.](streams.md#manual-streaming)329330### subprocess.stdout331

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 332why, one step back
332_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 333–341why, one step back
333
334The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.335336This 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`.337338[More info.](streams.md#manual-streaming)339340### subprocess.stderr341

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 342why, one step back
342_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 343–351why, one step back
343
344The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.345346This 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`.347348[More info.](streams.md#manual-streaming)349350### subprocess.all351

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 352why, one step back
352_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 353–363why, one step back
353
354Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).355356This requires the [`all`](#optionsall) option to be `true`.357358This is `undefined` if [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are 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`.359360More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).361362### subprocess.stdio363

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 364why, one step back
364_Type:_ [`[Writable | null, Readable | null, Readable | null, ...Array<Writable | Readable | null>]`](https://nodejs.org/api/stream.html#class-streamreadable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 365–382why, one step back
365
366The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.367368Each 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`.369370[More info.](streams.md#manual-streaming)371372### subprocess.readable(readableOptions?)373374`readableOptions`: [`ReadableOptions`](#readableoptions)\375_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream376377Converts the subprocess to a readable stream.378379[More info.](streams.md#converting-a-subprocess-to-a-stream)380381#### readableOptions382

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 383why, one step back
383_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 384–386why, one step back
384
385#### readableOptions.from386

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 387–388why, one step back
387_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\
388_Default:_ `"stdout"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 389–397why, one step back
389
390Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.391392`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.393394[More info.](streams.md#different-file-descriptor)395396#### readableOptions.binary397

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 398–399why, one step back
398_Type:_ `boolean`\
399_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 400–410why, one step back
400
401If `false`, iterates over lines. Each line is a string.402403If `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)).404405This is always `true` when the [`encoding`](#optionsencoding) option is binary.406407More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).408409#### readableOptions.preserveNewlines410

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 411–412why, one step back
411_Type:_ `boolean`\
412_Default:_ `false` with [`subprocess.iterable()`](#subprocessiterablereadableoptions), `true` with [`subprocess.readable()`](#subprocessreadablereadableoptions)/[`subprocess.duplex()`](#subprocessduplexduplexoptions)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 413–428why, one step back
413
414If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.415416[More info.](lines.md#iterable)417418### subprocess.writable(writableOptions?)419420`writableOptions`: [`WritableOptions`](#writableoptions)\421_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream422423Converts the subprocess to a writable stream.424425[More info.](streams.md#converting-a-subprocess-to-a-stream)426427#### writableOptions428

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 429why, one step back
429_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 430–432why, one step back
430
431#### writableOptions.to432

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 433–434why, one step back
433_Type:_ `"stdin" | "fd3" | "fd4" | ...`\
434_Default:_ `"stdin"`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 435–450why, one step back
435
436Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.437438[More info.](streams.md#different-file-descriptor)439440### subprocess.duplex(duplexOptions?)441442`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\443_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream444445Converts the subprocess to a duplex stream.446447[More info.](streams.md#converting-a-subprocess-to-a-stream)448449## Result450

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 451why, one step back
451_TypeScript:_ [`Result`](typescript.md) or [`SyncResult`](typescript.md\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 452why, one step back
452_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 453why, one step back
453

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 454why, one step back
454[Result](execution.md#result) of a subprocess successful execution.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 455–459why, one step back
455
456When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.457458### result.stdout459

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 460why, one step back
460_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 461–471why, one step back
461
462The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).463464This 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`.465466This is an array if the [`lines`](#optionslines) option is `true`, or if the `stdout` option is a [transform in object mode](transform.md#object-mode).467468[More info.](output.md#stdout-and-stderr)469470### result.stderr471

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 472why, one step back
472_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 473–483why, one step back
473
474The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).475476This 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`.477478This is an array if the [`lines`](#optionslines) option is `true`, or if the `stderr` option is a [transform in object mode](transform.md#object-mode).479480[More info.](output.md#stdout-and-stderr)481482### result.all483

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 484why, one step back
484_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 485–497why, one step back
485
486The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.487488This requires the [`all`](#optionsall) option to be `true`.489490This is `undefined` if both [`stdout`](#optionsstdout) and [`stderr`](#optionsstderr) options are 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`.491492This is an array if the [`lines`](#optionslines) option is `true`, or if either the `stdout` or `stderr` option is a [transform in object mode](transform.md#object-mode).493494[More info.](output.md#interleaved-output)495496### result.stdio497

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 498why, one step back
498_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 499–507why, one step back
499
500The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).501502Items 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`.503504Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).505506[More info.](output.md#additional-file-descriptors)507

Rename `result.ipc` to `result.ipcOutput` (#1075)ehmickybefore adoptionae9b360

line 508why, one step back
508### result.ipcOutput

Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de

line 509why, one step back
509

Fix type of `result.ipc` (#1071)ehmickybefore adoption69152ec

line 510why, one step back
510_Type_: [`Message[]`](ipc.md#message-type)

Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de

lines 511–517why, one step back
511
512All the messages [sent by the subprocess](#sendmessagemessage) to the current process.513514This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.515516[More info.](ipc.md#retrieve-all-messages)517

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 518–519why, one step back
518### result.pipedFrom
519

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 520why, one step back
520_Type:_ [`Array<Result | ExecaError>`](#result)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 521–529why, one step back
521
522[Results](#result) of the other subprocesses that were piped into this subprocess.523524This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.525526[More info.](pipe.md#result)527528### result.command529

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 530why, one step back
530_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 531–537why, one step back
531
532The file and [arguments](input.md#command-arguments) that were run.533534[More info.](debugging.md#command)535536### result.escapedCommand537

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 538why, one step back
538_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 539–545why, one step back
539
540Same as [`command`](#resultcommand) but escaped.541542[More info.](debugging.md#command)543544### result.cwd545

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 546why, one step back
546_Type:_ `string`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 547–553why, one step back
547
548The [current directory](#optionscwd) in which the command was run.549550[More info.](environment.md#current-directory)551552### result.durationMs553

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 554why, one step back
554_Type:_ `number`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 555–561why, one step back
555
556Duration of the subprocess, in milliseconds.557558[More info.](debugging.md#duration)559560### result.failed561

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 562why, one step back
562_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 563–565why, one step back
563
564Whether the subprocess failed to run.565

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 566–567why, one step back
566When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.
567

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 568–569why, one step back
568[More info.](errors.md#subprocess-failure)
569

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 570–571why, one step back
570## ExecaError
571## ExecaSyncError

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 572why, one step back
572

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 573why, one step back
573_Type:_ `Error`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 574–584why, one step back
574
575Result of a subprocess [failed execution](errors.md#subprocess-failure).576577This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.578579This has the same shape as [successful results](#result), with the following additional properties.580581[More info.](errors.md)582583### error.message584

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 585why, one step back
585_Type:_ `string`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 586–592why, one step back
586
587Error message when the subprocess [failed](errors.md#subprocess-failure) to run.588589[More info.](errors.md#error-message)590591### error.shortMessage592

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 593why, one step back
593_Type:_ `string`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 594–600why, one step back
594
595This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).596597[More info.](errors.md#error-message)598599### error.originalMessage600

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 601why, one step back
601_Type:_ `string | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 602–608why, one step back
602
603Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.604605[More info.](errors.md#error-message)606607### error.cause608

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 609why, one step back
609_Type:_ `unknown | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 610–618why, one step back
610
611Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).612613This is usually an `Error` instance.614615[More info.](termination.md#error-message-and-stack-trace)616617### error.code618

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 619why, one step back
619_Type:_ `string | undefined`

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

lines 620–624why, one step back
620
621Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.622623### error.timedOut624

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 625why, one step back
625_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 626–630why, one step back
626
627Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.628629[More info.](termination.md#timeout)630

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 631why, one step back
631### error.isCanceled

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 632why, one step back
632

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 633why, one step back
633_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 634–638why, one step back
634
635Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.636637[More info.](termination.md#canceling)638

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 639why, one step back
639### error.isMaxBuffer

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 640why, one step back
640

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 641why, one step back
641_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 642–646why, one step back
642
643Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.644645[More info.](output.md#big-output)646

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 647why, one step back
647### error.isTerminated

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 648why, one step back
648

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 649why, one step back
649_Type:_ `boolean`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 650–656why, one step back
650
651Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:652- The current process.653- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).654655[More info.](termination.md#signal-name-and-description)656

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 657why, one step back
657### error.exitCode

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 658why, one step back
658

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 659why, one step back
659_Type:_ `number | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 660–662why, one step back
660
661The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.662

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 663why, one step back
663This is `undefined` when the subprocess could not be spawned or was terminated by a [signal](#errorsignal).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 664–666why, one step back
664
665[More info.](errors.md#exit-code)666

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 667why, one step back
667### error.signal

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 668why, one step back
668

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 669why, one step back
669_Type:_ `string | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 670–678why, one step back
670
671The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:672- The current process.673- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).674675If a signal terminated the subprocess, this property is defined and included in the [error message](#errormessage). Otherwise it is `undefined`.676677[More info.](termination.md#signal-name-and-description)678

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 679why, one step back
679### error.signalDescription

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 680why, one step back
680

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 681why, one step back
681_Type:_ `string | undefined`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 682–690why, one step back
682
683A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.684685If 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.686687[More info.](termination.md#signal-name-and-description)688689## Options690

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 691why, one step back
691_TypeScript:_ [`Options`](typescript.md) or [`SyncOptions`](typescript.md\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 692why, one step back
692_Type:_ `object`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 693–699why, one step back
693
694This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).695696The 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).697698### options.preferLocal699

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 700–701why, one step back
700_Type:_ `boolean`\
701_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 702–708why, one step back
702
703Prefer locally installed binaries when looking for a binary to execute.704705[More info.](environment.md#local-binaries)706707### options.localDir708

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 709–710why, one step back
709_Type:_ `string | URL`\
710_Default:_ [`cwd`](#optionscwd) option

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 711–717why, one step back
711
712Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.713714[More info.](environment.md#local-binaries)715716### options.node717

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 718–719why, one step back
718_Type:_ `boolean`\
719_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 720–722why, one step back
720
721If `true`, runs with Node.js. The first argument must be a Node.js file.722

Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5

lines 723–724why, one step back
723The subprocess inherits the current Node.js [CLI flags](https://nodejs.org/api/cli.html#options) and version. This can be overridden using the [`nodeOptions`](#optionsnodeoptions) and [`nodePath`](#optionsnodepath) options.
724

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 725–728why, one step back
725[More info.](node.md)
726727### options.nodeOptions728

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 729why, one step back
729_Type:_ `string[]`\

Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5

line 730why, one step back
730_Default:_ [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI flags)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 731–739why, one step back
731
732List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).733734Requires the [`node`](#optionsnode) option to be `true`.735736[More info.](node.md#nodejs-cli-flags)737738### options.nodePath739

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 740–741why, one step back
740_Type:_ `string | URL`\
741_Default:_ [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 742–750why, one step back
742
743Path to the Node.js executable.744745Requires the [`node`](#optionsnode) option to be `true`.746747[More info.](node.md#nodejs-version)748749### options.shell750

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 751–752why, one step back
751_Type:_ `boolean | string | URL`\
752_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 753–763why, one step back
753
754If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).755756Uses [`/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.757758We [recommend against](shell.md#avoiding-shells) using this option.759760[More info.](shell.md)761762### options.cwd763

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 764–765why, one step back
764_Type:_ `string | URL`\
765_Default:_ `process.cwd()`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 766–774why, one step back
766
767Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.768769This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.770771[More info.](environment.md#current-directory)772773### options.env774

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 775–776why, one step back
775_Type:_ `object`\
776_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 777–785why, one step back
777
778[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).779780Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).781782[More info.](input.md#environment-variables)783784### options.extendEnv785

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 786–787why, one step back
786_Type:_ `boolean`\
787_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 788–795why, one step back
788
789If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).790If `false`, only the `env` option is used, not `process.env`.791792[More info.](input.md#environment-variables)793794### options.input795

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 796why, one step back
796_Type:_ `string | Uint8Array | stream.Readable`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 797–805why, one step back
797
798Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).799800See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.801802[More info.](input.md#string-input)803804### options.inputFile805

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 806why, one step back
806_Type:_ `string | URL`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 807–815why, one step back
807
808Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).809810See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.811812[More info.](input.md#file-input)813814### options.stdin815

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 816why, one step back
816_TypeScript:_ [`StdinOption`](typescript.md) or [`StdinSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 817–818why, one step back
817_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)\
818_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 819–827why, one step back
819
820How 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).821822This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.823824More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).825826### options.stdout827

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 828why, one step back
828_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 829–830why, one step back
829_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)\
830_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 831–839why, one step back
831
832How 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).833834This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.835836More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).837838### options.stderr839

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 840why, one step back
840_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 841–842why, one step back
841_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)\
842_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 843–851why, one step back
843
844How 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).845846This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.847848More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).849850### options.stdio851

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 852why, one step back
852_TypeScript:_ [`Options['stdio']`](typescript.md) or [`SyncOptions['stdio']`](typescript.md)\

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 853–854why, one step back
853_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)\
854_Default:_ `pipe`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 855–865why, one step back
855
856Like 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'}`.857858A single string can be used [as a shortcut](output.md#shortcut).859860The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).861862More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).863864### options.all865

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 866–867why, one step back
866_Type:_ `boolean`\
867_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 868–874why, one step back
868
869Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.870871[More info.](output.md#interleaved-output)872873### options.encoding874

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 875–876why, one step back
875_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\
876_Default:_ `'utf8'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 877–889why, one step back
877
878If 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).879880If it outputs binary data instead, this should be either:881- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).882- [`'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.883884The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).885886[More info.](binary.md)887888### options.lines889

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 890–891why, one step back
890_Type:_ `boolean`\
891_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 892–902why, one step back
892
893Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.894895This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).896897By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).898899[More info.](lines.md#simple-splitting)900901### options.stripFinalNewline902

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 903–904why, one step back
903_Type:_ `boolean`\
904_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 905–915why, one step back
905
906Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.907908If the [`lines`](#optionslines) option is true, this applies to each output line instead.909910By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).911912[More info.](lines.md#newlines)913914### options.maxBuffer915

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 916–917why, one step back
916_Type:_ `number`\
917_Default:_ `100_000_000`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 918–926why, one step back
918
919Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).920921By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).922923[More info.](output.md#big-output)924925### options.buffer926

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 927–928why, one step back
927_Type:_ `boolean`\
928_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 929–937why, one step back
929
930When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.931932By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).933934[More info.](output.md#low-memory)935936### options.ipc937

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 938why, one step back
938_Type:_ `boolean`\

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 939why, one step back
939_Default:_ `true` if either the [`node`](#optionsnode) option or the [`ipcInput`](#optionsipcinput) is set, `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 940why, one step back
940

Add `exchangeMessage()` method (#1077)ehmickybefore adoption7a0a1c6

line 941why, one step back
941Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions), [`subprocess.exchangeMessage(message)`](#subprocessexchangemessagemessage-getonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 942why, one step back
942

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 943–944why, one step back
943The subprocess must be a Node.js file.
944

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 945–948why, one step back
945[More info.](ipc.md)
946947### options.serialization948

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 949–950why, one step back
949_Type:_ `'json' | 'advanced'`\
950_Default:_ `'advanced'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 951–954why, one step back
951
952Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.953954[More info.](ipc.md#message-type)

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 955–964why, one step back
955
956### options.ipcInput957958_Type_: [`Message`](ipc.md#message-type)959960Sends an IPC message when the subprocess starts.961962The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.963964More info [here](ipc.md#send-an-initial-message) and [there](input.md#any-input-type).

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 965–967why, one step back
965
966### options.verbose967

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 968–969why, one step back
968_Type:_ `'none' | 'short' | 'full'`\
969_Default:_ `'none'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 970–972why, one step back
970
971If `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.972

Log IPC messages with `verbose: 'full'` (#1063)ehmickybefore adoption839c2fe

line 973why, one step back
973If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)), `stderr` and [IPC messages](ipc.md) are also printed.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 974–980why, one step back
974
975By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).976977[More info.](debugging.md#verbose-mode)978979### options.reject980

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 981–982why, one step back
981_Type:_ `boolean`\
982_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

line 983why, one step back
983

Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b

line 984why, one step back
984Setting this to `false` resolves the [result's promise](#return-value) with the [error](#execaerror) instead of rejecting it.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 985–989why, one step back
985
986[More info.](errors.md#preventing-exceptions)987988### options.timeout989

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 990–991why, one step back
990_Type:_ `number`\
991_Default:_ `0`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 992–994why, one step back
992
993If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.994

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 995why, one step back
995On timeout, [`result.timedOut`](#errortimedout) becomes `true`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 996–1000why, one step back
996
997[More info.](termination.md#timeout)998999### options.cancelSignal1000

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 1001why, one step back
1001_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1002–1004why, one step back
1002
1003You can abort the subprocess using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).1004

Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec

line 1005why, one step back
1005When `AbortController.abort()` is called, [`result.isCanceled`](#erroriscanceled) becomes `true`.

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1006–1010why, one step back
1006
1007[More info.](termination.md#canceling)10081009### options.forceKillAfterDelay1010

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1011–1012why, one step back
1011_Type:_ `number | false`\
1012_Default:_ `5000`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1013–1019why, one step back
1013
1014If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).10151016[More info.](termination.md#forceful-termination)10171018### options.killSignal1019

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1020–1021why, one step back
1020_Type:_ `string | number`\
1021_Default:_ `'SIGTERM'`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1022–1030why, one step back
1022
1023Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10241025This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10261027[More info.](termination.md#default-signal)10281029### options.detached1030

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1031–1032why, one step back
1031_Type:_ `boolean`\
1032_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1033–1039why, one step back
1033
1034Run the subprocess independently from the current process.10351036[More info.](environment.md#background-subprocess)10371038### options.cleanup1039

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1040–1041why, one step back
1040_Type:_ `boolean`\
1041_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1042–1048why, one step back
1042
1043Kill the subprocess when the current process exits.10441045[More info.](termination.md#current-process-exit)10461047### options.uid1048

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1049–1050why, one step back
1049_Type:_ `number`\
1050_Default:_ current user identifier

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1051–1057why, one step back
1051
1052Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10531054[More info.](windows.md#uid-and-gid)10551056### options.gid1057

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1058–1059why, one step back
1058_Type:_ `number`\
1059_Default:_ current group identifier

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1060–1066why, one step back
1060
1061Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10621063[More info.](windows.md#uid-and-gid)10641065### options.argv01066

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1067–1068why, one step back
1067_Type:_ `string`\
1068_Default:_ file being executed

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1069–1073why, one step back
1069
1070Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10711072### options.windowsHide1073

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1074–1075why, one step back
1074_Type:_ `boolean`\
1075_Default:_ `true`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1076–1082why, one step back
1076
1077On Windows, do not create a new console window.10781079[More info.](windows.md#console-window)10801081### options.windowsVerbatimArguments1082

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1083–1084why, one step back
1083_Type:_ `boolean`\
1084_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwise

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1085–1099why, one step back
1085
1086If `false`, escapes the command arguments on Windows.10871088[More info.](windows.md#cmdexe-escaping)10891090## Transform options10911092A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10931094A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10951096[More info.](transform.md)10971098### transformOptions.transform1099

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 1100why, one step back
1100_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1101–1107why, one step back
1101
1102Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.11031104More info [here](transform.md#summary) and [there](transform.md#sharing-state).11051106### transformOptions.final1107

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

line 1108why, one step back
1108_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1109–1115why, one step back
1109
1110Create additional lines after the last one.11111112[More info.](transform.md#finalizing)11131114### transformOptions.binary1115

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1116–1117why, one step back
1116_Type:_ `boolean`\
1117_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1118–1124why, one step back
1118
1119If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11201121[More info.](binary.md#transforms)11221123### transformOptions.preserveNewlines1124

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1125–1126why, one step back
1125_Type:_ `boolean`\
1126_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1127–1133why, one step back
1127
1128If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11291130[More info.](lines.md#transforms)11311132### transformOptions.objectMode1133

Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f

lines 1134–1135why, one step back
1134_Type:_ `boolean`\
1135_Default:_ `false`

Move API reference to its own page (#996)ehmickybefore adoption7cde496

lines 1136–1144why, one step back
1136
1137If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11381139[More info.](transform.md#object-mode)11401141<hr>11421143[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1144[**Top**: Table of contents](../readme.md#documentation)