Skip to content
Myr

api.md

This file

Path

docs/api.md

1,135 lines · 44.7 KiB · Markdown

Last changed by

Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42

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 `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

line 95why, one step back
95### sendMessage(message, sendMessageOptions?)

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 96–97why, one step back
96
97`message`: [`Message`](ipc.md#message-type)\

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

line 98why, one step back
98`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 99–106why, one step back
99_Returns_: `Promise<void>`
100101Send a `message` to the parent process.102103This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.104105[More info.](ipc.md#exchanging-messages)106

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

lines 107–119why, one step back
107#### sendMessageOptions
108109_Type_: `object`110111#### sendMessageOptions.strict112113_Type_: `boolean`\114_Default_: `false`115116Throw when the other process is not receiving or listening to messages.117118[More info.](ipc.md#ensure-messages-are-received)119

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 121why, one step back
121

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 131–142why, one step back
131#### getOneMessageOptions
132133_Type_: `object`134135#### getOneMessageOptions.filter136137_Type_: [`(Message) => boolean`](ipc.md#message-type)138139Ignore any `message` that returns `false`.140141[More info.](ipc.md#filter-messages)142

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

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

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

line 154why, one step back
154

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

line 157why, one step back
157

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

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

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

lines 159–160why, one step back
159- the [subprocess](#subprocess).
160- 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 161–163why, one step back
161
162[More info.](execution.md#subprocess)163

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

lines 164–165why, one step back
164## Subprocess
165

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 170–212why, one step back
170### subprocess\[Symbol.asyncIterator\]()
171172_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)173174Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.175176[More info.](lines.md#progressive-splitting)177178### subprocess.iterable(readableOptions?)179180`readableOptions`: [`ReadableOptions`](#readableoptions)\181_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)182183Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.184185[More info.](lines.md#progressive-splitting)186187### subprocess.pipe(file, arguments?, options?)188189`file`: `string | URL`\190`arguments`: `string[]`\191`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\192_Returns_: [`Promise<Result>`](#result)193194[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.195196This 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.197198[More info.](pipe.md#array-syntax)199200### subprocess.pipe\`command\`201### subprocess.pipe(options)\`command\`202203`command`: `string`\204`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\205_Returns_: [`Promise<Result>`](#result)206207Like [`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).208209[More info.](pipe.md#template-string-syntax)210211### subprocess.pipe(secondSubprocess, pipeOptions?)212

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

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

line 217why, one step back
217Like [`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 218–222why, one step back
218
219[More info.](pipe.md#advanced-syntax)220221#### pipeOptions222

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

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

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

lines 224–226why, one step back
224
225#### pipeOptions.from226

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

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

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

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

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

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

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

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

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

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

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

lines 248–259why, one step back
248
249Unpipe the subprocess when the signal aborts.250251[More info.](pipe.md#unpipe)252253### subprocess.kill(signal, error?)254### subprocess.kill(error?)255256`signal`: `string | number`\257`error`: `Error`\258_Returns_: `boolean`259

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

line 260why, one step back
260Sends 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 261–269why, one step back
261
262This returns `false` when the signal could not be sent, for example when the subprocess has already exited.263264When 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).265266[More info.](termination.md)267268### subprocess.pid269

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

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

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

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

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

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

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

line 279why, one step back
279

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

line 281why, one step back
281`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 282why, one step back
282_Returns_: `Promise<void>`

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

line 283why, one step back
283

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 285why, one step back
285

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 286why, one step back
286This 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 287–289why, one step back
287
288[More info.](ipc.md#exchanging-messages)289

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

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

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

line 291why, one step back
291

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 294why, one step back
294

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 296why, one step back
296

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 297why, one step back
297This 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 298–300why, one step back
298
299[More info.](ipc.md#exchanging-messages)300

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 311–312why, one step back
311### subprocess.stdin
312

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

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

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

lines 314–322why, one step back
314
315The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.316317This 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).318319[More info.](streams.md#manual-streaming)320321### subprocess.stdout322

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

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

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

lines 324–332why, one step back
324
325The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.326327This 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`.328329[More info.](streams.md#manual-streaming)330331### subprocess.stderr332

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

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

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

lines 334–342why, one step back
334
335The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.336337This 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`.338339[More info.](streams.md#manual-streaming)340341### subprocess.all342

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

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

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

lines 344–354why, one step back
344
345Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).346347This requires the [`all`](#optionsall) option to be `true`.348349This 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`.350351More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).352353### subprocess.stdio354

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

line 355why, one step back
355_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 356–373why, one step back
356
357The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.358359Each 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`.360361[More info.](streams.md#manual-streaming)362363### subprocess.readable(readableOptions?)364365`readableOptions`: [`ReadableOptions`](#readableoptions)\366_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream367368Converts the subprocess to a readable stream.369370[More info.](streams.md#converting-a-subprocess-to-a-stream)371372#### readableOptions373

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

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

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

lines 375–377why, one step back
375
376#### readableOptions.from377

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

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

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

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

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

lines 389–390why, one step back
389_Type:_ `boolean`\
390_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 391–401why, one step back
391
392If `false`, iterates over lines. Each line is a string.393394If `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)).395396This is always `true` when the [`encoding`](#optionsencoding) option is binary.397398More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).399400#### readableOptions.preserveNewlines401

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

lines 402–403why, one step back
402_Type:_ `boolean`\
403_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 404–419why, one step back
404
405If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.406407[More info.](lines.md#iterable)408409### subprocess.writable(writableOptions?)410411`writableOptions`: [`WritableOptions`](#writableoptions)\412_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream413414Converts the subprocess to a writable stream.415416[More info.](streams.md#converting-a-subprocess-to-a-stream)417418#### writableOptions419

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

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

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

lines 421–423why, one step back
421
422#### writableOptions.to423

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

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

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

lines 426–441why, one step back
426
427Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.428429[More info.](streams.md#different-file-descriptor)430431### subprocess.duplex(duplexOptions?)432433`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\434_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream435436Converts the subprocess to a duplex stream.437438[More info.](streams.md#converting-a-subprocess-to-a-stream)439440## Result441

Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42

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

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

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

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

line 444why, one step back
444

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

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

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

lines 446–450why, one step back
446
447When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.448449### result.stdout450

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

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

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

lines 452–462why, one step back
452
453The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).454455This 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`.456457This 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).458459[More info.](output.md#stdout-and-stderr)460461### result.stderr462

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

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

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

lines 464–474why, one step back
464
465The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).466467This 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`.468469This 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).470471[More info.](output.md#stdout-and-stderr)472473### result.all474

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

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

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

lines 476–488why, one step back
476
477The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.478479This requires the [`all`](#optionsall) option to be `true`.480481This 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`.482483This 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).484485[More info.](output.md#interleaved-output)486487### result.stdio488

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

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

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

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

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

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

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

line 500why, one step back
500

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

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

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

line 502why, one step back
502

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

line 503why, one step back
503All the messages [sent by the subprocess](#sendmessagemessage-sendmessageoptions) to the current process.

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

lines 504–508why, one step back
504
505This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.506507[More info.](ipc.md#retrieve-all-messages)508

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

lines 509–510why, one step back
509### result.pipedFrom
510

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

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

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

lines 512–520why, one step back
512
513[Results](#result) of the other subprocesses that were piped into this subprocess.514515This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.516517[More info.](pipe.md#result)518519### result.command520

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

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

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

lines 522–528why, one step back
522
523The file and [arguments](input.md#command-arguments) that were run.524525[More info.](debugging.md#command)526527### result.escapedCommand528

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

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

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

lines 530–536why, one step back
530
531Same as [`command`](#resultcommand) but escaped.532533[More info.](debugging.md#command)534535### result.cwd536

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

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

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

lines 538–544why, one step back
538
539The [current directory](#optionscwd) in which the command was run.540541[More info.](environment.md#current-directory)542543### result.durationMs544

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

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

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

lines 546–552why, one step back
546
547Duration of the subprocess, in milliseconds.548549[More info.](debugging.md#duration)550551### result.failed552

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

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

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

lines 554–556why, one step back
554
555Whether the subprocess failed to run.556

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

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

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

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

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

lines 561–562why, one step back
561## ExecaError
562## ExecaSyncError

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

line 563why, one step back
563

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

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

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

lines 565–575why, one step back
565
566Result of a subprocess [failed execution](errors.md#subprocess-failure).567568This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.569570This has the same shape as [successful results](#result), with the following additional properties.571572[More info.](errors.md)573574### error.message575

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

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

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

lines 577–583why, one step back
577
578Error message when the subprocess [failed](errors.md#subprocess-failure) to run.579580[More info.](errors.md#error-message)581582### error.shortMessage583

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

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

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

lines 585–591why, one step back
585
586This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).587588[More info.](errors.md#error-message)589590### error.originalMessage591

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

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

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

lines 593–599why, one step back
593
594Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.595596[More info.](errors.md#error-message)597598### error.cause599

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

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

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

lines 601–609why, one step back
601
602Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).603604This is usually an `Error` instance.605606[More info.](termination.md#error-message-and-stack-trace)607608### error.code609

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

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

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

lines 611–615why, one step back
611
612Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.613614### error.timedOut615

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

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

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

lines 617–621why, one step back
617
618Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.619620[More info.](termination.md#timeout)621

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

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

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

line 623why, one step back
623

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

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

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

lines 625–629why, one step back
625
626Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.627628[More info.](termination.md#canceling)629

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

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

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

line 631why, one step back
631

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

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

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

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

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

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

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

line 639why, one step back
639

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

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

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

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

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

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

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

line 649why, one step back
649

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

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

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

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

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

line 654why, one step back
654This 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 655–657why, one step back
655
656[More info.](errors.md#exit-code)657

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

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

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

line 659why, one step back
659

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

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

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

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

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

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

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

line 671why, one step back
671

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

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

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

lines 673–681why, one step back
673
674A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.675676If 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.677678[More info.](termination.md#signal-name-and-description)679680## Options681

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 684–690why, one step back
684
685This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).686687The 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).688689### options.preferLocal690

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

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

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

lines 693–699why, one step back
693
694Prefer locally installed binaries when looking for a binary to execute.695696[More info.](environment.md#local-binaries)697698### options.localDir699

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

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

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

lines 702–708why, one step back
702
703Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.704705[More info.](environment.md#local-binaries)706707### options.node708

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

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

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

lines 711–713why, one step back
711
712If `true`, runs with Node.js. The first argument must be a Node.js file.713

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

lines 714–715why, one step back
714The 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.
715

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

lines 716–719why, one step back
716[More info.](node.md)
717718### options.nodeOptions719

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

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

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

line 721why, one step back
721_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 722–730why, one step back
722
723List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).724725Requires the [`node`](#optionsnode) option to be `true`.726727[More info.](node.md#nodejs-cli-flags)728729### options.nodePath730

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

lines 731–732why, one step back
731_Type:_ `string | URL`\
732_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 733–741why, one step back
733
734Path to the Node.js executable.735736Requires the [`node`](#optionsnode) option to be `true`.737738[More info.](node.md#nodejs-version)739740### options.shell741

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

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

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

lines 744–754why, one step back
744
745If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).746747Uses [`/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.748749We [recommend against](shell.md#avoiding-shells) using this option.750751[More info.](shell.md)752753### options.cwd754

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

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

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

lines 757–765why, one step back
757
758Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.759760This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.761762[More info.](environment.md#current-directory)763764### options.env765

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

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

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

lines 768–776why, one step back
768
769[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).770771Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).772773[More info.](input.md#environment-variables)774775### options.extendEnv776

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

lines 777–778why, one step back
777_Type:_ `boolean`\
778_Default:_ `true`

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

lines 779–786why, one step back
779
780If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).781If `false`, only the `env` option is used, not `process.env`.782783[More info.](input.md#environment-variables)784785### options.input786

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

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

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

lines 788–796why, one step back
788
789Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).790791See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.792793[More info.](input.md#string-input)794795### options.inputFile796

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

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

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

lines 798–806why, one step back
798
799Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).800801See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.802803[More info.](input.md#file-input)804805### options.stdin806

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 810–818why, one step back
810
811How 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).812813This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.814815More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).816817### options.stdout818

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 822–830why, one step back
822
823How 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).824825This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.826827More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).828829### options.stderr830

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 834–842why, one step back
834
835How 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).836837This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.838839More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).840841### options.stdio842

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

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

lines 857–858why, one step back
857_Type:_ `boolean`\
858_Default:_ `false`

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

lines 859–865why, one step back
859
860Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.861862[More info.](output.md#interleaved-output)863864### options.encoding865

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

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

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

lines 868–880why, one step back
868
869If 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).870871If it outputs binary data instead, this should be either:872- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).873- [`'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.874875The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).876877[More info.](binary.md)878879### options.lines880

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

lines 881–882why, one step back
881_Type:_ `boolean`\
882_Default:_ `false`

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

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

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

lines 894–895why, one step back
894_Type:_ `boolean`\
895_Default:_ `true`

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

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

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

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

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

lines 909–917why, one step back
909
910Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).911912By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).913914[More info.](output.md#big-output)915916### options.buffer917

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

lines 918–919why, one step back
918_Type:_ `boolean`\
919_Default:_ `true`

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 930why, one step back
930_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 931why, one step back
931

Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10

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

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

line 933why, one step back
933

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

lines 936–939why, one step back
936[More info.](ipc.md)
937938### options.serialization939

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 946–955why, one step back
946
947### options.ipcInput948949_Type_: [`Message`](ipc.md#message-type)950951Sends an IPC message when the subprocess starts.952953The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.954955More 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 956–958why, one step back
956
957### options.verbose958

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

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

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

lines 961–963why, one step back
961
962If `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.963

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

line 964why, one step back
964If `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 965–971why, one step back
965
966By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).967968[More info.](debugging.md#verbose-mode)969970### options.reject971

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

lines 972–973why, one step back
972_Type:_ `boolean`\
973_Default:_ `true`

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

line 974why, one step back
974

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

line 975why, one step back
975Setting 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 976–980why, one step back
976
977[More info.](errors.md#preventing-exceptions)978979### options.timeout980

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

lines 981–982why, one step back
981_Type:_ `number`\
982_Default:_ `0`

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

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

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

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

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

lines 987–991why, one step back
987
988[More info.](termination.md#timeout)989990### options.cancelSignal991

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

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

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

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

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

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

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

lines 997–1001why, one step back
997
998[More info.](termination.md#canceling)9991000### options.forceKillAfterDelay1001

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

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

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

lines 1004–1010why, one step back
1004
1005If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).10061007[More info.](termination.md#forceful-termination)10081009### options.killSignal1010

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

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

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

lines 1013–1021why, one step back
1013
1014Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10151016This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10171018[More info.](termination.md#default-signal)10191020### options.detached1021

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

lines 1022–1023why, one step back
1022_Type:_ `boolean`\
1023_Default:_ `false`

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

lines 1024–1030why, one step back
1024
1025Run the subprocess independently from the current process.10261027[More info.](environment.md#background-subprocess)10281029### options.cleanup1030

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

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

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

lines 1033–1039why, one step back
1033
1034Kill the subprocess when the current process exits.10351036[More info.](termination.md#current-process-exit)10371038### options.uid1039

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

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

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

lines 1042–1048why, one step back
1042
1043Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10441045[More info.](windows.md#uid-and-gid)10461047### options.gid1048

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

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

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

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

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

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

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

lines 1060–1064why, one step back
1060
1061Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10621063### options.windowsHide1064

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

lines 1065–1066why, one step back
1065_Type:_ `boolean`\
1066_Default:_ `true`

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

lines 1067–1073why, one step back
1067
1068On Windows, do not create a new console window.10691070[More info.](windows.md#console-window)10711072### options.windowsVerbatimArguments1073

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

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

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

lines 1076–1090why, one step back
1076
1077If `false`, escapes the command arguments on Windows.10781079[More info.](windows.md#cmdexe-escaping)10801081## Transform options10821083A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.10841085A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.10861087[More info.](transform.md)10881089### transformOptions.transform1090

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

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

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

lines 1092–1098why, one step back
1092
1093Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.10941095More info [here](transform.md#summary) and [there](transform.md#sharing-state).10961097### transformOptions.final1098

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

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

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

lines 1100–1106why, one step back
1100
1101Create additional lines after the last one.11021103[More info.](transform.md#finalizing)11041105### transformOptions.binary1106

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

lines 1107–1108why, one step back
1107_Type:_ `boolean`\
1108_Default:_ `false`

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

lines 1109–1115why, one step back
1109
1110If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11111112[More info.](binary.md#transforms)11131114### transformOptions.preserveNewlines1115

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`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11201121[More info.](lines.md#transforms)11221123### transformOptions.objectMode1124

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–1135why, one step back
1127
1128If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11291130[More info.](transform.md#object-mode)11311132<hr>11331134[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1135[**Top**: Table of contents](../readme.md#documentation)