Skip to content
Myr

api.md

This file

Path

docs/api.md

1,159 lines · 45.3 KiB · Markdown

Last changed by

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

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 `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

line 143why, one step back
143#### getOneMessageOptions.reference

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 144why, one step back
144

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

lines 145–154why, one step back
145_Type_: `boolean`\
146_Default_: `true`147148Keep the subprocess alive while `getOneMessage()` is waiting.149150[More info.](ipc.md#keeping-the-subprocess-alive)151152### getEachMessage(getEachMessageOptions?)153154`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

lines 163–175why, one step back
163#### getEachMessageOptions
164165_Type_: `object`166167#### getEachMessageOptions.reference168169_Type_: `boolean`\170_Default_: `true`171172Keep the subprocess alive while `getEachMessage()` is waiting.173174[More info.](ipc.md#keeping-the-subprocess-alive)175

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

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

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

line 177why, one step back
177

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

line 180why, one step back
180

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

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

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

lines 182–183why, one step back
182- the [subprocess](#subprocess).
183- 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 184–186why, one step back
184
185[More info.](execution.md#subprocess)186

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

lines 187–188why, one step back
187## Subprocess
188

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 193–235why, one step back
193### subprocess\[Symbol.asyncIterator\]()
194195_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)196197Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.198199[More info.](lines.md#progressive-splitting)200201### subprocess.iterable(readableOptions?)202203`readableOptions`: [`ReadableOptions`](#readableoptions)\204_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)205206Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.207208[More info.](lines.md#progressive-splitting)209210### subprocess.pipe(file, arguments?, options?)211212`file`: `string | URL`\213`arguments`: `string[]`\214`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\215_Returns_: [`Promise<Result>`](#result)216217[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.218219This 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.220221[More info.](pipe.md#array-syntax)222223### subprocess.pipe\`command\`224### subprocess.pipe(options)\`command\`225226`command`: `string`\227`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\228_Returns_: [`Promise<Result>`](#result)229230Like [`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).231232[More info.](pipe.md#template-string-syntax)233234### subprocess.pipe(secondSubprocess, pipeOptions?)235

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

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

line 240why, one step back
240Like [`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 241–245why, one step back
241
242[More info.](pipe.md#advanced-syntax)243244#### pipeOptions245

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

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

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

lines 247–249why, one step back
247
248#### pipeOptions.from249

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

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

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

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

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

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

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

lines 263–269why, one step back
263
264Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.265266[More info.](pipe.md#destination-file-descriptor)267268#### pipeOptions.unpipeSignal269

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

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

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

lines 271–282why, one step back
271
272Unpipe the subprocess when the signal aborts.273274[More info.](pipe.md#unpipe)275276### subprocess.kill(signal, error?)277### subprocess.kill(error?)278279`signal`: `string | number`\280`error`: `Error`\281_Returns_: `boolean`282

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

line 283why, one step back
283Sends 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 284–292why, one step back
284
285This returns `false` when the signal could not be sent, for example when the subprocess has already exited.286287When 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).288289[More info.](termination.md)290291### subprocess.pid292

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

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

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

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

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

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

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

line 302why, one step back
302

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 306why, one step back
306

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 308why, one step back
308

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 309why, one step back
309This 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 310–312why, one step back
310
311[More info.](ipc.md#exchanging-messages)312

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

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

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

line 314why, one step back
314

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 317why, one step back
317

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 319why, one step back
319

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 320why, one step back
320This 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 321–323why, one step back
321
322[More info.](ipc.md#exchanging-messages)323

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

line 324why, one step back
324### subprocess.getEachMessage(getEachMessageOptions?)

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 325why, one step back
325

Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6

line 326why, one step back
326`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 335–336why, one step back
335### subprocess.stdin
336

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

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

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

lines 338–346why, one step back
338
339The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.340341This 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).342343[More info.](streams.md#manual-streaming)344345### subprocess.stdout346

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

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

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

lines 348–356why, one step back
348
349The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.350351This 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`.352353[More info.](streams.md#manual-streaming)354355### subprocess.stderr356

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

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

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

lines 358–366why, one step back
358
359The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.360361This 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`.362363[More info.](streams.md#manual-streaming)364365### subprocess.all366

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

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

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

lines 368–378why, one step back
368
369Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).370371This requires the [`all`](#optionsall) option to be `true`.372373This 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`.374375More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).376377### subprocess.stdio378

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

line 379why, one step back
379_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 380–397why, one step back
380
381The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.382383Each 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`.384385[More info.](streams.md#manual-streaming)386387### subprocess.readable(readableOptions?)388389`readableOptions`: [`ReadableOptions`](#readableoptions)\390_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream391392Converts the subprocess to a readable stream.393394[More info.](streams.md#converting-a-subprocess-to-a-stream)395396#### readableOptions397

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

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

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

lines 399–401why, one step back
399
400#### readableOptions.from401

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

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

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

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

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

lines 413–414why, one step back
413_Type:_ `boolean`\
414_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 415–425why, one step back
415
416If `false`, iterates over lines. Each line is a string.417418If `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)).419420This is always `true` when the [`encoding`](#optionsencoding) option is binary.421422More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).423424#### readableOptions.preserveNewlines425

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

lines 426–427why, one step back
426_Type:_ `boolean`\
427_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 428–443why, one step back
428
429If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.430431[More info.](lines.md#iterable)432433### subprocess.writable(writableOptions?)434435`writableOptions`: [`WritableOptions`](#writableoptions)\436_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream437438Converts the subprocess to a writable stream.439440[More info.](streams.md#converting-a-subprocess-to-a-stream)441442#### writableOptions443

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

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

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

lines 445–447why, one step back
445
446#### writableOptions.to447

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

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

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

lines 450–465why, one step back
450
451Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.452453[More info.](streams.md#different-file-descriptor)454455### subprocess.duplex(duplexOptions?)456457`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\458_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream459460Converts the subprocess to a duplex stream.461462[More info.](streams.md#converting-a-subprocess-to-a-stream)463464## Result465

Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42

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

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

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

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

line 468why, one step back
468

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

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

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

lines 470–474why, one step back
470
471When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.472473### result.stdout474

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–486why, one step back
476
477The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).478479This 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`.480481This 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).482483[More info.](output.md#stdout-and-stderr)484485### result.stderr486

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

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

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

lines 488–498why, one step back
488
489The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).490491This 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`.492493This 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).494495[More info.](output.md#stdout-and-stderr)496497### result.all498

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

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

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

lines 500–512why, one step back
500
501The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.502503This requires the [`all`](#optionsall) option to be `true`.504505This 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`.506507This 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).508509[More info.](output.md#interleaved-output)510511### result.stdio512

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

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

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

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

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

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

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

line 524why, one step back
524

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

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

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

line 526why, one step back
526

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

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

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

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

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

lines 533–534why, one step back
533### result.pipedFrom
534

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

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

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

lines 536–544why, one step back
536
537[Results](#result) of the other subprocesses that were piped into this subprocess.538539This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.540541[More info.](pipe.md#result)542543### result.command544

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

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

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

lines 546–552why, one step back
546
547The file and [arguments](input.md#command-arguments) that were run.548549[More info.](debugging.md#command)550551### result.escapedCommand552

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

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

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

lines 554–560why, one step back
554
555Same as [`command`](#resultcommand) but escaped.556557[More info.](debugging.md#command)558559### result.cwd560

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

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

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

lines 562–568why, one step back
562
563The [current directory](#optionscwd) in which the command was run.564565[More info.](environment.md#current-directory)566567### result.durationMs568

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

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

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

lines 570–576why, one step back
570
571Duration of the subprocess, in milliseconds.572573[More info.](debugging.md#duration)574575### result.failed576

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

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

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

lines 578–580why, one step back
578
579Whether the subprocess failed to run.580

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

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

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

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

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

lines 585–586why, one step back
585## ExecaError
586## ExecaSyncError

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

line 587why, one step back
587

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

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

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

lines 589–599why, one step back
589
590Result of a subprocess [failed execution](errors.md#subprocess-failure).591592This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.593594This has the same shape as [successful results](#result), with the following additional properties.595596[More info.](errors.md)597598### error.message599

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

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

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

lines 601–607why, one step back
601
602Error message when the subprocess [failed](errors.md#subprocess-failure) to run.603604[More info.](errors.md#error-message)605606### error.shortMessage607

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

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

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

lines 609–615why, one step back
609
610This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).611612[More info.](errors.md#error-message)613614### error.originalMessage615

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

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

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

lines 617–623why, one step back
617
618Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.619620[More info.](errors.md#error-message)621622### error.cause623

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

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

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

lines 625–633why, one step back
625
626Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).627628This is usually an `Error` instance.629630[More info.](termination.md#error-message-and-stack-trace)631632### error.code633

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

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

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

lines 635–639why, one step back
635
636Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.637638### error.timedOut639

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–645why, one step back
641
642Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.643644[More info.](termination.md#timeout)645

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

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

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

line 647why, one step back
647

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

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

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

lines 649–653why, one step back
649
650Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.651652[More info.](termination.md#canceling)653

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

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

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

line 655why, one step back
655

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

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

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

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

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

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

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

line 663why, one step back
663

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

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

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

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

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

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

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

line 673why, one step back
673

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

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

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

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

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

line 678why, one step back
678This 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 679–681why, one step back
679
680[More info.](errors.md#exit-code)681

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

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

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

line 683why, one step back
683

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

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

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

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

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

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

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

line 695why, one step back
695

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

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

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

lines 697–705why, one step back
697
698A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.699700If 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.701702[More info.](termination.md#signal-name-and-description)703704## Options705

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 708–714why, one step back
708
709This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).710711The 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).712713### options.preferLocal714

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

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

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

lines 717–723why, one step back
717
718Prefer locally installed binaries when looking for a binary to execute.719720[More info.](environment.md#local-binaries)721722### options.localDir723

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

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

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

lines 726–732why, one step back
726
727Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.728729[More info.](environment.md#local-binaries)730731### options.node732

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

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

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

lines 735–737why, one step back
735
736If `true`, runs with Node.js. The first argument must be a Node.js file.737

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

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

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

lines 740–743why, one step back
740[More info.](node.md)
741742### options.nodeOptions743

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

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

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

line 745why, one step back
745_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 746–754why, one step back
746
747List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).748749Requires the [`node`](#optionsnode) option to be `true`.750751[More info.](node.md#nodejs-cli-flags)752753### options.nodePath754

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

lines 755–756why, one step back
755_Type:_ `string | URL`\
756_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 757–765why, one step back
757
758Path to the Node.js executable.759760Requires the [`node`](#optionsnode) option to be `true`.761762[More info.](node.md#nodejs-version)763764### options.shell765

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

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

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

lines 768–778why, one step back
768
769If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).770771Uses [`/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.772773We [recommend against](shell.md#avoiding-shells) using this option.774775[More info.](shell.md)776777### options.cwd778

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

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

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

lines 781–789why, one step back
781
782Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.783784This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.785786[More info.](environment.md#current-directory)787788### options.env789

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

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

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

lines 792–800why, one step back
792
793[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).794795Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).796797[More info.](input.md#environment-variables)798799### options.extendEnv800

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

lines 801–802why, one step back
801_Type:_ `boolean`\
802_Default:_ `true`

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

lines 803–810why, one step back
803
804If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).805If `false`, only the `env` option is used, not `process.env`.806807[More info.](input.md#environment-variables)808809### options.input810

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

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

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

lines 812–820why, one step back
812
813Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).814815See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.816817[More info.](input.md#string-input)818819### options.inputFile820

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

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

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

lines 822–830why, one step back
822
823Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).824825See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.826827[More info.](input.md#file-input)828829### options.stdin830

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 846–854why, one step back
846
847How 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).848849This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.850851More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).852853### options.stderr854

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 858–866why, one step back
858
859How 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).860861This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.862863More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).864865### options.stdio866

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

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–889why, one step back
883
884Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.885886[More info.](output.md#interleaved-output)887888### options.encoding889

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

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

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

lines 892–904why, one step back
892
893If 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).894895If it outputs binary data instead, this should be either:896- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).897- [`'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.898899The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).900901[More info.](binary.md)902903### options.lines904

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

lines 905–906why, one step back
905_Type:_ `boolean`\
906_Default:_ `false`

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

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

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–930why, one step back
920
921Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.922923If the [`lines`](#optionslines) option is true, this applies to each output line instead.924925By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).926927[More info.](lines.md#newlines)928929### options.maxBuffer930

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

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

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

lines 933–941why, one step back
933
934Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).935936By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).937938[More info.](output.md#big-output)939940### options.buffer941

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

lines 942–943why, one step back
942_Type:_ `boolean`\
943_Default:_ `true`

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 954why, one step back
954_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 955why, one step back
955

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

line 956why, one step back
956Enables 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 957why, one step back
957

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

lines 960–963why, one step back
960[More info.](ipc.md)
961962### options.serialization963

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 970–979why, one step back
970
971### options.ipcInput972973_Type_: [`Message`](ipc.md#message-type)974975Sends an IPC message when the subprocess starts.976977The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.978979More 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 980–982why, one step back
980
981### options.verbose982

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

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

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

lines 985–987why, one step back
985
986If `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.987

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

line 988why, one step back
988If `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 989–995why, one step back
989
990By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).991992[More info.](debugging.md#verbose-mode)993994### options.reject995

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

lines 996–997why, one step back
996_Type:_ `boolean`\
997_Default:_ `true`

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

line 998why, one step back
998

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

line 999why, one step back
999Setting 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 1000–1004why, one step back
1000
1001[More info.](errors.md#preventing-exceptions)10021003### options.timeout1004

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

lines 1005–1006why, one step back
1005_Type:_ `number`\
1006_Default:_ `0`

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

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

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

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

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

lines 1011–1015why, one step back
1011
1012[More info.](termination.md#timeout)10131014### options.cancelSignal1015

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

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

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

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

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

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

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

lines 1021–1025why, one step back
1021
1022[More info.](termination.md#canceling)10231024### options.forceKillAfterDelay1025

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

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

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

lines 1028–1034why, one step back
1028
1029If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).10301031[More info.](termination.md#forceful-termination)10321033### options.killSignal1034

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

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

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

lines 1037–1045why, one step back
1037
1038Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10391040This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10411042[More info.](termination.md#default-signal)10431044### options.detached1045

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

lines 1046–1047why, one step back
1046_Type:_ `boolean`\
1047_Default:_ `false`

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

lines 1048–1054why, one step back
1048
1049Run the subprocess independently from the current process.10501051[More info.](environment.md#background-subprocess)10521053### options.cleanup1054

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

lines 1055–1056why, one step back
1055_Type:_ `boolean`\
1056_Default:_ `true`

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

lines 1057–1063why, one step back
1057
1058Kill the subprocess when the current process exits.10591060[More info.](termination.md#current-process-exit)10611062### options.uid1063

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

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

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

lines 1066–1072why, one step back
1066
1067Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10681069[More info.](windows.md#uid-and-gid)10701071### options.gid1072

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

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

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

lines 1075–1081why, one step back
1075
1076Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10771078[More info.](windows.md#uid-and-gid)10791080### options.argv01081

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

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

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

lines 1084–1088why, one step back
1084
1085Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10861087### options.windowsHide1088

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

lines 1089–1090why, one step back
1089_Type:_ `boolean`\
1090_Default:_ `true`

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

lines 1091–1097why, one step back
1091
1092On Windows, do not create a new console window.10931094[More info.](windows.md#console-window)10951096### options.windowsVerbatimArguments1097

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

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

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

lines 1100–1114why, one step back
1100
1101If `false`, escapes the command arguments on Windows.11021103[More info.](windows.md#cmdexe-escaping)11041105## Transform options11061107A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.11081109A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.11101111[More info.](transform.md)11121113### transformOptions.transform1114

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

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

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

lines 1116–1122why, one step back
1116
1117Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.11181119More info [here](transform.md#summary) and [there](transform.md#sharing-state).11201121### transformOptions.final1122

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

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

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

lines 1124–1130why, one step back
1124
1125Create additional lines after the last one.11261127[More info.](transform.md#finalizing)11281129### transformOptions.binary1130

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

lines 1131–1132why, one step back
1131_Type:_ `boolean`\
1132_Default:_ `false`

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

lines 1133–1139why, one step back
1133
1134If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11351136[More info.](binary.md#transforms)11371138### transformOptions.preserveNewlines1139

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

lines 1140–1141why, one step back
1140_Type:_ `boolean`\
1141_Default:_ `false`

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

lines 1142–1148why, one step back
1142
1143If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11441145[More info.](lines.md#transforms)11461147### transformOptions.objectMode1148

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

lines 1149–1150why, one step back
1149_Type:_ `boolean`\
1150_Default:_ `false`

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

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