Skip to content
Myr

api.md

This file

Path

docs/api.md

1,169 lines · 45.7 KiB · Markdown

Last changed by

Add `error.isForcefullyTerminated` (#1111)ehmickybefore adoptione69985d

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

Add `error.isForcefullyTerminated` (#1111)ehmickybefore adoptione69985d

lines 672–679why, one step back
672### error.isForcefullyTerminated
673674_Type:_ `boolean`675676Whether the subprocess was terminated by the [`SIGKILL`](termination.md#sigkill) signal sent by the [`forceKillAfterDelay`](#optionsforcekillafterdelay) option.677678[More info.](termination.md#forceful-termination)679

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

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

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

line 681why, one step back
681

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

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

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

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

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

line 686why, one step back
686This 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 687–689why, one step back
687
688[More info.](errors.md#exit-code)689

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

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

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

line 691why, one step back
691

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

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

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

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

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

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

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

line 703why, one step back
703

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

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

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

lines 705–713why, one step back
705
706A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.707708If 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.709710[More info.](termination.md#signal-name-and-description)711712## Options713

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 716–722why, one step back
716
717This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).718719The 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).720721### options.preferLocal722

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

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

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

lines 725–731why, one step back
725
726Prefer locally installed binaries when looking for a binary to execute.727728[More info.](environment.md#local-binaries)729730### options.localDir731

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

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

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

lines 734–740why, one step back
734
735Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.736737[More info.](environment.md#local-binaries)738739### options.node740

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

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

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

lines 743–745why, one step back
743
744If `true`, runs with Node.js. The first argument must be a Node.js file.745

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

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

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

lines 748–751why, one step back
748[More info.](node.md)
749750### options.nodeOptions751

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

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

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

line 753why, one step back
753_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 754–762why, one step back
754
755List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).756757Requires the [`node`](#optionsnode) option to be `true`.758759[More info.](node.md#nodejs-cli-flags)760761### options.nodePath762

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

lines 763–764why, one step back
763_Type:_ `string | URL`\
764_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 765–773why, one step back
765
766Path to the Node.js executable.767768Requires the [`node`](#optionsnode) option to be `true`.769770[More info.](node.md#nodejs-version)771772### options.shell773

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

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

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

lines 776–786why, one step back
776
777If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).778779Uses [`/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.780781We [recommend against](shell.md#avoiding-shells) using this option.782783[More info.](shell.md)784785### options.cwd786

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

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

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

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

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

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

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

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

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

lines 809–810why, one step back
809_Type:_ `boolean`\
810_Default:_ `true`

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

lines 811–818why, one step back
811
812If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).813If `false`, only the `env` option is used, not `process.env`.814815[More info.](input.md#environment-variables)816817### options.input818

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

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

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

lines 820–828why, one step back
820
821Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).822823See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.824825[More info.](input.md#string-input)826827### options.inputFile828

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

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

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

lines 830–838why, one step back
830
831Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).832833See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.834835[More info.](input.md#file-input)836837### options.stdin838

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

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

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

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

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

lines 891–897why, one step back
891
892Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.893894[More info.](output.md#interleaved-output)895896### options.encoding897

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

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

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

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

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

lines 913–914why, one step back
913_Type:_ `boolean`\
914_Default:_ `false`

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

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

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

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

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

lines 928–938why, one step back
928
929Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.930931If the [`lines`](#optionslines) option is true, this applies to each output line instead.932933By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).934935[More info.](lines.md#newlines)936937### options.maxBuffer938

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

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

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

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

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

lines 950–951why, one step back
950_Type:_ `boolean`\
951_Default:_ `true`

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

line 962why, one step back
962_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 963why, one step back
963

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

line 964why, one step back
964Enables 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 965why, one step back
965

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

lines 968–971why, one step back
968[More info.](ipc.md)
969970### options.serialization971

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 978–987why, one step back
978
979### options.ipcInput980981_Type_: [`Message`](ipc.md#message-type)982983Sends an IPC message when the subprocess starts.984985The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.986987More 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 988–990why, one step back
988
989### options.verbose990

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

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

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

lines 993–995why, one step back
993
994If `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.995

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

line 996why, one step back
996If `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 997–1003why, one step back
997
998By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).9991000[More info.](debugging.md#verbose-mode)10011002### options.reject1003

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

lines 1004–1005why, one step back
1004_Type:_ `boolean`\
1005_Default:_ `true`

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

line 1006why, one step back
1006

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

line 1007why, one step back
1007Setting 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 1008–1012why, one step back
1008
1009[More info.](errors.md#preventing-exceptions)10101011### options.timeout1012

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

lines 1013–1014why, one step back
1013_Type:_ `number`\
1014_Default:_ `0`

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

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

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

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

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

lines 1019–1023why, one step back
1019
1020[More info.](termination.md#timeout)10211022### options.cancelSignal1023

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

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

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

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

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

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

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

lines 1029–1033why, one step back
1029
1030[More info.](termination.md#canceling)10311032### options.forceKillAfterDelay1033

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

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

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

lines 1036–1037why, one step back
1036
1037If the subprocess is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).

Add `error.isForcefullyTerminated` (#1111)ehmickybefore adoptione69985d

lines 1038–1039why, one step back
1038
1039When this happens, [`error.isForcefullyTerminated`](#errorisforcefullyterminated) becomes `true`.

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

lines 1040–1044why, one step back
1040
1041[More info.](termination.md#forceful-termination)10421043### options.killSignal1044

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

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

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

lines 1047–1055why, one step back
1047
1048Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10491050This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10511052[More info.](termination.md#default-signal)10531054### options.detached1055

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

lines 1056–1057why, one step back
1056_Type:_ `boolean`\
1057_Default:_ `false`

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

lines 1058–1064why, one step back
1058
1059Run the subprocess independently from the current process.10601061[More info.](environment.md#background-subprocess)10621063### options.cleanup1064

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
1068Kill the subprocess when the current process exits.10691070[More info.](termination.md#current-process-exit)10711072### options.uid1073

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

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

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

lines 1076–1082why, one step back
1076
1077Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.10781079[More info.](windows.md#uid-and-gid)10801081### options.gid1082

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

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

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

lines 1085–1091why, one step back
1085
1086Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.10871088[More info.](windows.md#uid-and-gid)10891090### options.argv01091

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

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

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

lines 1094–1098why, one step back
1094
1095Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.10961097### options.windowsHide1098

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

lines 1099–1100why, one step back
1099_Type:_ `boolean`\
1100_Default:_ `true`

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

lines 1101–1107why, one step back
1101
1102On Windows, do not create a new console window.11031104[More info.](windows.md#console-window)11051106### options.windowsVerbatimArguments1107

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

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

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

lines 1110–1124why, one step back
1110
1111If `false`, escapes the command arguments on Windows.11121113[More info.](windows.md#cmdexe-escaping)11141115## Transform options11161117A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.11181119A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.11201121[More info.](transform.md)11221123### transformOptions.transform1124

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

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

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

lines 1126–1132why, one step back
1126
1127Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.11281129More info [here](transform.md#summary) and [there](transform.md#sharing-state).11301131### transformOptions.final1132

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

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

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

lines 1134–1140why, one step back
1134
1135Create additional lines after the last one.11361137[More info.](transform.md#finalizing)11381139### transformOptions.binary1140

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

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

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

lines 1143–1149why, one step back
1143
1144If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11451146[More info.](binary.md#transforms)11471148### transformOptions.preserveNewlines1149

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

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

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

lines 1152–1158why, one step back
1152
1153If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11541155[More info.](lines.md#transforms)11561157### transformOptions.objectMode1158

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

lines 1159–1160why, one step back
1159_Type:_ `boolean`\
1160_Default:_ `false`

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

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