Skip to content
Myr

api.md

This file

Path

docs/api.md

1,365 lines · 54.4 KiB · Markdown

Last changed by

Fix `killDescendants` signaling unrelated processes once Execa is done with the subprocessSindre Sorhusbefore adoption9c5c71c

History of this file

Take it

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

lines 1–8why, 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 reference8

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 9why, one step back
9This lists all available [methods](#methods) and their [options](#options-1). This also describes the properties of the [subprocess](#subprocess), [result](#result) and [error](#execaerror) they return.

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

lines 10–16why, one step back
10
11## Methods1213### execa(file, arguments?, options?)1415`file`: `string | URL`\16`arguments`: `string[]`\

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 17why, one step back
17`options`: [`Options`](#options-1)\

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–23why, 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).23

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 24why, one step back
24### $(file, arguments?, options?)

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

line 25why, one step back
25

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 26–28why, one step back
26`file`: `string | URL`\
27`arguments`: `string[]`\28`options`: [`Options`](#options-1)\

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

line 30why, one step back
30

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 31why, one step back
31Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).

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

line 32why, one step back
32

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 33why, one step back
33This is the preferred method when executing multiple commands in a script file.

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

line 34why, one step back
34

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 35why, one step back
35[More info.](scripts.md)

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

line 36why, one step back
36

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 37why, one step back
37### execaNode(scriptPath, arguments?, options?)

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

line 38why, one step back
38

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 39–42why, one step back
39`scriptPath`: `string | URL`\
40`arguments`: `string[]`\41`options`: [`Options`](#options-1)\42_Returns_: [`ResultPromise`](#return-value)

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

line 43why, one step back
43

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 44–45why, one step back
44Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.
45Executes a Node.js file using `node scriptPath ...arguments`.

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

line 46why, one step back
46

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 47–50why, one step back
47This is the preferred method when executing Node.js files.
4849[More info.](node.md)50

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

line 51why, one step back
51### execaSync(file, arguments?, options?)

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 52–53why, one step back
52### $.sync(file, arguments?, options?)
53### $.s(file, arguments?, options?)

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

line 54why, one step back
54

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 55–57why, one step back
55`file`: `string | URL`\
56`arguments`: `string[]`\57`options`: [`SyncOptions`](#options-1)\

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

line 59why, one step back
59

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 60why, one step back
60Same as [`execa()`](#execafile-arguments-options) and [`$`](#file-arguments-options) but synchronous.

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

line 61why, one step back
61

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 62why, one step back
62Returns a subprocess [`result`](#result) or throws an [`error`](#execasyncerror). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.

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

line 63why, one step back
63

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 64–65why, one step back
64Those methods are discouraged as they hold the CPU and lack multiple features.
65

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

lines 66–67why, one step back
66[More info.](execution.md#synchronous-execution)
67

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 68–73why, one step back
68### execa\`command\`
69### $\`command\`70### execaNode\`command\`71### execaSync\`command\`72### $.sync\`command\`73### $.s\`command\`

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

line 74why, one step back
74

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 75–76why, one step back
75`command`: `string`\
76_Returns_: [`ResultPromise`](#return-value), [`SyncResult`](#return-value)

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

line 77why, one step back
77

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 78why, one step back
78Same as [`execa()`](#execafile-arguments-options), [`$()`](#file-arguments-options), [`execaNode()`](#execanodescriptpath-arguments-options) and [`execaSync()`](#execasyncfile-arguments-options) but using a [template string](execution.md#template-string-syntax). `command` includes both the `file` and its `arguments`.

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

line 79why, one step back
79

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 80why, one step back
80More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).

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

line 81why, one step back
81

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 82–87why, one step back
82### execa(options)\`command\`
83### $(options)\`command\`84### execaNode(options)\`command\`85### execaSync(options)\`command\`86### $.sync(options)\`command\`87### $.s(options)\`command\`

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

line 88why, one step back
88

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 89–91why, one step back
89`command`: `string`\
90`options`: [`Options`](#options-1), [`SyncOptions`](#options-1)\91_Returns_: [`ResultPromise`](#return-value), [`SyncResult`](#return-value)

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

line 92why, one step back
92

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 93why, one step back
93Same as [```execa`command` ```](#execacommand) but with [options](#options-1).

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

line 94why, one step back
94

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 95why, one step back
95[More info.](execution.md#template-string-syntax)

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

line 96why, one step back
96

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 97–102why, one step back
97### execa(options)
98### $(options)99### execaNode(options)100### execaSync(options)101### $.sync(options)102### $.s(options)

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

line 103why, one step back
103

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

lines 104–105why, one step back
104`options`: [`Options`](#options-1), [`SyncOptions`](#options-1)\
105_Returns_: [`ExecaMethod`](#execafile-arguments-options), [`ExecaScriptMethod`](#file-arguments-options), [`ExecaNodeMethod`](#execanodescriptpath-arguments-options), [`ExecaSyncMethod`](#execasyncfile-arguments-options), [`ExecaScriptSyncMethod`](#syncfile-arguments-options)

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

line 106why, one step back
106

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 107why, one step back
107Returns a new instance of those methods but with different default [`options`](#options-1). Consecutive calls are merged to previous ones.

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

line 108why, one step back
108

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 109why, one step back
109[More info.](execution.md#globalshared-options)

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

line 110why, one step back
110

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

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

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

lines 112–113why, one step back
112
113`command`: `string`\

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

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

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

line 115why, one step back
115

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

line 116why, one step back
116Split 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 117–119why, one step back
117
118[More info.](escaping.md#user-defined-input)119

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 132–144why, one step back
132#### sendMessageOptions
133134_Type_: `object`135136#### sendMessageOptions.strict137138_Type_: `boolean`\139_Default_: `false`140141Throw when the other process is not receiving or listening to messages.142143[More info.](ipc.md#ensure-messages-are-received)144

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 146why, one step back
146

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 156–167why, one step back
156#### getOneMessageOptions
157158_Type_: `object`159160#### getOneMessageOptions.filter161162_Type_: [`(Message) => boolean`](ipc.md#message-type)163164Ignore any `message` that returns `false`.165166[More info.](ipc.md#filter-messages)167

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 169why, one step back
169

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

lines 170–179why, one step back
170_Type_: `boolean`\
171_Default_: `true`172173Keep the subprocess alive while `getOneMessage()` is waiting.174175[More info.](ipc.md#keeping-the-subprocess-alive)176177### getEachMessage(getEachMessageOptions?)178179`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 188–200why, one step back
188#### getEachMessageOptions
189190_Type_: `object`191192#### getEachMessageOptions.reference193194_Type_: `boolean`\195_Default_: `true`196197Keep the subprocess alive while `getEachMessage()` is waiting.198199[More info.](ipc.md#keeping-the-subprocess-alive)200

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 201–210why, one step back
201### getCancelSignal()
202203_Returns_: [`Promise<AbortSignal>`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)204205Retrieves the [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) shared by the [`cancelSignal`](#optionscancelsignal) option.206207This can only be called inside a subprocess. This requires the [`gracefulCancel`](#optionsgracefulcancel) option to be `true`.208209[More info.](termination.md#graceful-termination)210

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

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

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

line 212why, one step back
212

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

line 213why, one step back
213_TypeScript:_ [`ResultPromise`](typescript.md)\

Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf

line 214why, one step back
214_Type:_ `Subprocess`

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

line 215why, one step back
215

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

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

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

lines 217–218why, one step back
217- the [subprocess](#subprocess).
218- 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 219–221why, one step back
219
220[More info.](execution.md#subprocess)221

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

lines 222–223why, one step back
222## Subprocess
223

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

line 225why, one step back
225

Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf

line 226why, one step back
226Promise with the following Execa-specific methods and properties.

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

line 227why, one step back
227

Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf

lines 228–229why, one step back
228The underlying Node.js [`ChildProcess`](https://nodejs.org/api/child_process.html#class-childprocess) instance is available as [`subprocess.nodeChildProcess`](#subprocessnodechildprocess). This is an escape hatch for Node.js-specific APIs that Execa does not document, such as `.on()`, `.send()`, `.disconnect()`, `.ref()` and `.unref()`.
229

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

lines 230–250why, one step back
230### subprocess\[Symbol.asyncIterator\]()
231232_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)233234Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.235236[More info.](lines.md#progressive-splitting)237238### subprocess.iterable(readableOptions?)239240`readableOptions`: [`ReadableOptions`](#readableoptions)\241_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)242243Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.244245[More info.](lines.md#progressive-splitting)246247### subprocess.pipe(file, arguments?, options?)248249`file`: `string | URL`\250`arguments`: `string[]`\

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 251why, one step back
251`options`: [`Options`](#options-1) and [`PipeOptions`](#pipeoptions)\

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

lines 252–255why, one step back
252_Returns_: [`Promise<Result>`](#result)
253254[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.255

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 256why, one step back
256This follows the same syntax as [`execa(file, arguments?, options?)`](#execafile-arguments-options) except both [regular options](#options-1) and [pipe-specific options](#pipeoptions) can be specified.

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

line 257why, one step back
257

Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c

lines 258–259why, one step back
258Like a subprocess, the return value can be [iterated](lines.md#progressive-splitting), [converted to a stream](streams.md#converting-a-subprocess-to-a-stream), or used for [IPC](ipc.md) with the destination subprocess.
259

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

lines 260–265why, one step back
260[More info.](pipe.md#array-syntax)
261262### subprocess.pipe\`command\`263### subprocess.pipe(options)\`command\`264265`command`: `string`\

Improve documentation of Execa methods (#1115)ehmickybefore adoptionca2e813

line 266why, one step back
266`options`: [`Options`](#options-1) and [`PipeOptions`](#pipeoptions)\

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

lines 267–268why, one step back
267_Returns_: [`Promise<Result>`](#result)
268

Fix broken Markdown links (#1119)ehmickybefore adoption8572eb1

line 269why, one step back
269Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using a [`command` template string](execution.md#template-string-syntax) instead. This follows the same syntax as `execa` [template strings](execution.md#template-string-syntax).

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

lines 270–274why, one step back
270
271[More info.](pipe.md#template-string-syntax)272273### subprocess.pipe(secondSubprocess, pipeOptions?)274

Rename some types (#1009)ehmickybefore adoption2ef9186

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

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

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

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

line 279why, one step back
279Like [`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 280–284why, one step back
280
281[More info.](pipe.md#advanced-syntax)282283#### pipeOptions284

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

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

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

lines 286–288why, one step back
286
287#### pipeOptions.from288

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

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

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

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

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

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

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

lines 302–308why, one step back
302
303Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.304305[More info.](pipe.md#destination-file-descriptor)306307#### pipeOptions.unpipeSignal308

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

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

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

lines 310–321why, one step back
310
311Unpipe the subprocess when the signal aborts.312313[More info.](pipe.md#unpipe)314315### subprocess.kill(signal, error?)316### subprocess.kill(error?)317318`signal`: `string | number`\319`error`: `Error`\320_Returns_: `boolean`321

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

line 322why, one step back
322Sends 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 323–331why, one step back
323
324This returns `false` when the signal could not be sent, for example when the subprocess has already exited.325326When 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).327328[More info.](termination.md)329330### subprocess.pid331

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

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

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

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

Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf

lines 339–346why, one step back
339
340### subprocess.nodeChildProcess341342_Type:_ [`ChildProcess`](https://nodejs.org/api/child_process.html#class-childprocess)343344Underlying Node.js child process instance.345346This is intended as an escape hatch for Node.js-specific APIs that Execa does not document.

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

line 347why, one step back
347

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

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

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

line 349why, one step back
349

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 353why, one step back
353

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 355why, one step back
355

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 356why, one step back
356This 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 357–359why, one step back
357
358[More info.](ipc.md#exchanging-messages)359

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

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

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

line 361why, one step back
361

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 364why, one step back
364

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

line 366why, one step back
366

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 367why, one step back
367This 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 368–370why, one step back
368
369[More info.](ipc.md#exchanging-messages)370

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

line 372why, one step back
372

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

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

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

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

lines 382–383why, one step back
382### subprocess.stdin
383

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

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

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

lines 385–393why, one step back
385
386The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.387388This 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).389390[More info.](streams.md#manual-streaming)391392### subprocess.stdout393

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

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

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

lines 395–403why, one step back
395
396The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.397398This 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`.399400[More info.](streams.md#manual-streaming)401402### subprocess.stderr403

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

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

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

lines 405–413why, one step back
405
406The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.407408This 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`.409410[More info.](streams.md#manual-streaming)411412### subprocess.all413

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

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

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

lines 415–425why, one step back
415
416Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).417418This requires the [`all`](#optionsall) option to be `true`.419420This 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`.421422More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).423424### subprocess.stdio425

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

line 426why, one step back
426_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 427–444why, one step back
427
428The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.429430Each 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`.431432[More info.](streams.md#manual-streaming)433434### subprocess.readable(readableOptions?)435436`readableOptions`: [`ReadableOptions`](#readableoptions)\437_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream438439Converts the subprocess to a readable stream.440441[More info.](streams.md#converting-a-subprocess-to-a-stream)442443#### readableOptions444

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

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

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

lines 446–448why, one step back
446
447#### readableOptions.from448

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

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

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

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

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

lines 460–461why, one step back
460_Type:_ `boolean`\
461_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 462–472why, one step back
462
463If `false`, iterates over lines. Each line is a string.464465If `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)).466467This is always `true` when the [`encoding`](#optionsencoding) option is binary.468469More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).470471#### readableOptions.preserveNewlines472

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

lines 473–474why, one step back
473_Type:_ `boolean`\
474_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 475–490why, one step back
475
476If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.477478[More info.](lines.md#iterable)479480### subprocess.writable(writableOptions?)481482`writableOptions`: [`WritableOptions`](#writableoptions)\483_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream484485Converts the subprocess to a writable stream.486487[More info.](streams.md#converting-a-subprocess-to-a-stream)488489#### writableOptions490

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

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

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

lines 492–494why, one step back
492
493#### writableOptions.to494

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

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

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

lines 497–510why, one step back
497
498Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.499500[More info.](streams.md#different-file-descriptor)501502### subprocess.duplex(duplexOptions?)503504`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\505_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream506507Converts the subprocess to a duplex stream.508509[More info.](streams.md#converting-a-subprocess-to-a-stream)510

Add `.readableStream()`, `.writableStream()` and `.transformStream()` methods (#1254)Sindre Sorhusbefore adoption29d9cfc

lines 511–537why, one step back
511### subprocess.readableStream(readableOptions?)
512513`readableOptions`: [`ReadableOptions`](#readableoptions)\514_Returns_: [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) web stream515516Converts the subprocess to a readable web stream.517518[More info.](streams.md#converting-a-subprocess-to-a-web-stream)519520### subprocess.writableStream(writableOptions?)521522`writableOptions`: [`WritableOptions`](#writableoptions)\523_Returns_: [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream) web stream524525Converts the subprocess to a writable web stream.526527[More info.](streams.md#converting-a-subprocess-to-a-web-stream)528529### subprocess.transformStream(duplexOptions?)530531`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\532_Returns_: [`{readable: ReadableStream, writable: WritableStream}`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream)533534Converts the subprocess to a [`{readable, writable}`](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream) pair of web streams.535536[More info.](streams.md#converting-a-subprocess-to-a-web-stream)537

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

lines 538–539why, one step back
538## Result
539

Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42

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

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

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

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

line 542why, one step back
542

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

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

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

lines 544–548why, one step back
544
545When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.546547### result.stdout548

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

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

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

lines 550–560why, one step back
550
551The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).552553This 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`.554555This 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).556557[More info.](output.md#stdout-and-stderr)558559### result.stderr560

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

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

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

lines 562–572why, one step back
562
563The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).564565This 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`.566567This 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).568569[More info.](output.md#stdout-and-stderr)570571### result.all572

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

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

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

lines 574–586why, one step back
574
575The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.576577This requires the [`all`](#optionsall) option to be `true`.578579This 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`.580581This 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).582583[More info.](output.md#interleaved-output)584585### result.stdio586

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

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

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

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

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

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

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

line 598why, one step back
598

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

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

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

line 600why, one step back
600

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

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

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

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

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

lines 607–608why, one step back
607### result.pipedFrom
608

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

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

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

lines 610–618why, one step back
610
611[Results](#result) of the other subprocesses that were piped into this subprocess.612613This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.614615[More info.](pipe.md#result)616617### result.command618

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

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

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

lines 620–626why, one step back
620
621The file and [arguments](input.md#command-arguments) that were run.622623[More info.](debugging.md#command)624625### result.escapedCommand626

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

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

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

lines 628–634why, one step back
628
629Same as [`command`](#resultcommand) but escaped.630631[More info.](debugging.md#command)632633### result.cwd634

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

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

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

lines 636–642why, one step back
636
637The [current directory](#optionscwd) in which the command was run.638639[More info.](environment.md#current-directory)640641### result.durationMs642

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

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

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

lines 644–650why, one step back
644
645Duration of the subprocess, in milliseconds.646647[More info.](debugging.md#duration)648649### result.failed650

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

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

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

lines 652–654why, one step back
652
653Whether the subprocess failed to run.654

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

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

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

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

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

lines 659–660why, one step back
659## ExecaError
660## ExecaSyncError

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

line 661why, one step back
661

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

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

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

lines 663–673why, one step back
663
664Result of a subprocess [failed execution](errors.md#subprocess-failure).665666This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.667668This has the same shape as [successful results](#result), with the following additional properties.669670[More info.](errors.md)671672### error.message673

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

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

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

lines 675–681why, one step back
675
676Error message when the subprocess [failed](errors.md#subprocess-failure) to run.677678[More info.](errors.md#error-message)679680### error.shortMessage681

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

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

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

lines 683–689why, one step back
683
684This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).685686[More info.](errors.md#error-message)687688### error.originalMessage689

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

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

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

lines 691–697why, one step back
691
692Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.693694[More info.](errors.md#error-message)695696### error.cause697

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

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

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

lines 699–707why, one step back
699
700Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).701702This is usually an `Error` instance.703704[More info.](termination.md#error-message-and-stack-trace)705706### error.code707

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

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

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

lines 709–713why, one step back
709
710Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.711712### error.timedOut713

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

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

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

lines 715–719why, one step back
715
716Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.717718[More info.](termination.md#timeout)719

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

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

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

line 721why, one step back
721

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

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

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

lines 723–727why, one step back
723
724Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.725726[More info.](termination.md#canceling)727

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 728–735why, one step back
728### error.isGracefullyCanceled
729730_Type:_ `boolean`731732Whether the subprocess was canceled using both the [`cancelSignal`](#optionscancelsignal) and the [`gracefulCancel`](#optionsgracefulcancel) options.733734[More info.](termination.md#graceful-termination)735

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

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

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

line 737why, one step back
737

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

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

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

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

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

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

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

line 745why, one step back
745

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

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

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

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

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

lines 754–761why, one step back
754### error.isForcefullyTerminated
755756_Type:_ `boolean`757758Whether the subprocess was terminated by the [`SIGKILL`](termination.md#sigkill) signal sent by the [`forceKillAfterDelay`](#optionsforcekillafterdelay) option.759760[More info.](termination.md#forceful-termination)761

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

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

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

line 763why, one step back
763

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

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

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

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

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

line 768why, one step back
768This 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 769–771why, one step back
769
770[More info.](errors.md#exit-code)771

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

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

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

line 773why, one step back
773

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

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

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

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

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

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

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

line 785why, one step back
785

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

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

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

lines 787–795why, one step back
787
788A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.789790If 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.791792[More info.](termination.md#signal-name-and-description)793794## Options795

Fix a typo (#1153)Reuben Thomasbefore adoption3fc8049

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

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

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

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

lines 798–804why, one step back
798
799This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).800801The 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).802803### options.preferLocal804

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

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

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

lines 807–813why, one step back
807
808Prefer locally installed binaries when looking for a binary to execute.809810[More info.](environment.md#local-binaries)811812### options.localDir813

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

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

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

lines 816–822why, one step back
816
817Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.818819[More info.](environment.md#local-binaries)820821### options.node822

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

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

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

lines 825–827why, one step back
825
826If `true`, runs with Node.js. The first argument must be a Node.js file.827

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

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

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

lines 830–833why, one step back
830[More info.](node.md)
831832### options.nodeOptions833

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

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

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

line 835why, one step back
835_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 836–844why, one step back
836
837List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).838839Requires the [`node`](#optionsnode) option to be `true`.840841[More info.](node.md#nodejs-cli-flags)842843### options.nodePath844

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

lines 845–846why, one step back
845_Type:_ `string | URL`\
846_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 847–855why, one step back
847
848Path to the Node.js executable.849850Requires the [`node`](#optionsnode) option to be `true`.851852[More info.](node.md#nodejs-version)853854### options.shell855

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

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

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

lines 858–868why, one step back
858
859If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).860861Uses [`/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.862863We [recommend against](shell.md#avoiding-shells) using this option.864865[More info.](shell.md)866867### options.cwd868

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

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

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

lines 871–879why, one step back
871
872Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.873874This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.875876[More info.](environment.md#current-directory)877878### options.env879

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

line 880why, one step back
880_Type:_ `object`\

Fix `extendEnv: false` inheriting `process.env` when `env` is not setSindre Sorhusbefore adoption67acf60

line 881why, one step back
881_Default:_ `{}`

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

lines 882–890why, one step back
882
883[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).884885Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).886887[More info.](input.md#environment-variables)888889### options.extendEnv890

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

lines 891–892why, one step back
891_Type:_ `boolean`\
892_Default:_ `true`

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

lines 893–900why, one step back
893
894If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).895If `false`, only the `env` option is used, not `process.env`.896897[More info.](input.md#environment-variables)898899### options.input900

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

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

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

lines 902–910why, one step back
902
903Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).904905See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.906907[More info.](input.md#string-input)908909### options.inputFile910

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

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

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

lines 912–920why, one step back
912
913Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).914915See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.916917[More info.](input.md#file-input)918919### options.stdin920

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 924–932why, one step back
924
925How 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).926927This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.928929More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).930931### options.stdout932

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 936–944why, one step back
936
937How 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).938939This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.940941More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).942943### options.stderr944

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

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

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

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

lines 948–956why, one step back
948
949How 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).950951This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.952953More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).954955### options.stdio956

Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058

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

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 958why, one step back
958_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} | {value: 'pipe' | 'inherit' | number | URL | {file: string} | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}; input?: boolean}>` (or a tuple of those types)\

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

line 959why, one step back
959_Default:_ `pipe`

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

lines 960–964why, one step back
960
961Like 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'}`.962963A single string can be used [as a shortcut](output.md#shortcut).964

Generalize `{value, input}` to any direction-ambiguous stdio value (#1249)Sindre Sorhusbefore adoption9fbf5ba

line 965why, one step back
965The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr). Some values have an ambiguous direction on an additional file descriptor (like `'pipe'`, `'inherit'`, a file or a transform), so they default to output. To use one for [input](input.md#additional-file-descriptors) instead, wrap it as `{value, input: true}`.

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

lines 966–970why, one step back
966
967More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).968969### options.all970

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

lines 971–972why, one step back
971_Type:_ `boolean`\
972_Default:_ `false`

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

lines 973–979why, one step back
973
974Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.975976[More info.](output.md#interleaved-output)977978### options.encoding979

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

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

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

lines 982–986why, one step back
982
983If 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).984985If it outputs binary data instead, this should be either:986- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).

Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454

line 987why, one step back
987- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#RFC_4648), [`'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.

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

lines 988–990why, one step back
988
989The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).990

Fix the `encoding` option and line splitting in transformsSindre Sorhusbefore adoption6adb3c3

lines 991–992why, one step back
991String input passed with the [`input`](#optionsinput) or [`stdin`](#optionsstdin) option is always encoded with UTF-8, whatever this option is. With a text encoding, [`stdin` transforms](transform.md) also decode their input with UTF-8.
992

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

lines 993–996why, one step back
993[More info.](binary.md)
994995### options.lines996

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

lines 997–998why, one step back
997_Type:_ `boolean`\
998_Default:_ `false`

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

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

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

lines 1010–1011why, one step back
1010_Type:_ `boolean`\
1011_Default:_ `true`

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

lines 1012–1022why, one step back
1012
1013Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.10141015If the [`lines`](#optionslines) option is true, this applies to each output line instead.10161017By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).10181019[More info.](lines.md#newlines)10201021### options.maxBuffer1022

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

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

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

lines 1025–1029why, one step back
1025
1026Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).10271028By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).1029

Fix `maxBuffer` being ignored or wrongly appliedSindre Sorhusbefore adoption9547e51

lines 1030–1031why, one step back
1030With [synchronous methods](execution.md#synchronous-execution), this cannot be enforced per file descriptor while the subprocess runs, since `spawnSync()` only accepts a single value, which limits the total output of all file descriptors. The `maxBuffer.stdout` value is used for it. The other file descriptors' own values are enforced from the output, once the subprocess ended, and cannot be higher than `maxBuffer.stdout`.
1031

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 1032–1033why, one step back
1032When reached, [`error.isMaxBuffer`](#errorismaxbuffer) becomes `true`.
1033

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

lines 1034–1037why, one step back
1034[More info.](output.md#big-output)
10351036### options.buffer1037

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

lines 1038–1039why, one step back
1038_Type:_ `boolean`\
1039_Default:_ `true`

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

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

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

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

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

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

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

line 1051why, one step back
1051

Fix broken Markdown links (#1119)ehmickybefore adoption8572eb1

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

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

line 1053why, one step back
1053

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

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

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

lines 1056–1059why, one step back
1056[More info.](ipc.md)
10571058### options.serialization1059

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

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

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

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

Add `ipcInput` option (#1068)ehmickybefore adoption46cae30

lines 1066–1075why, one step back
1066
1067### options.ipcInput10681069_Type_: [`Message`](ipc.md#message-type)10701071Sends an IPC message when the subprocess starts.10721073The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.10741075More 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 1076–1078why, one step back
1076
1077### options.verbose1078

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

line 1079why, one step back
1079_Type:_ `'none' | 'short' | 'full' | Function`\

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

line 1080why, one step back
1080_Default:_ `'none'`

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

lines 1081–1083why, one step back
1081
1082If `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.1083

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

line 1084why, one step back
1084If `verbose` is `'full'` or a function, 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

line 1085why, one step back
1085

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

lines 1086–1087why, one step back
1086A [function](#verbose-function) can be passed to customize logging. Please see [this page](debugging.md#custom-logging) for more information.
1087

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

lines 1088–1093why, one step back
1088By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).
10891090[More info.](debugging.md#verbose-mode)10911092### options.reject1093

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

lines 1094–1095why, one step back
1094_Type:_ `boolean`\
1095_Default:_ `true`

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

line 1096why, one step back
1096

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

line 1097why, one step back
1097Setting 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 1098–1102why, one step back
1098
1099[More info.](errors.md#preventing-exceptions)11001101### options.timeout1102

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

lines 1103–1104why, one step back
1103_Type:_ `number`\
1104_Default:_ `0`

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

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

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

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

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

lines 1109–1113why, one step back
1109
1110[More info.](termination.md#timeout)11111112### options.cancelSignal1113

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

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

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

line 1115why, one step back
1115

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

line 1116why, one step back
1116When the `cancelSignal` is [aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), terminate the subprocess using a `SIGTERM` signal.

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

line 1117why, one step back
1117

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

line 1118why, one step back
1118When aborted, [`error.isCanceled`](#erroriscanceled) becomes `true`.

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

lines 1119–1120why, one step back
1119
1120[More info.](termination.md#canceling)

Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5

lines 1121–1133why, one step back
1121
1122### options.gracefulCancel11231124_Type:_ `boolean`\1125_Default:_: `false`11261127When the [`cancelSignal`](#optionscancelsignal) option is [aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort), do not send any [`SIGTERM`](termination.md#canceling). Instead, abort the [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) returned by [`getCancelSignal()`](#getcancelsignal). The subprocess should use it to terminate gracefully.11281129The subprocess must be a [Node.js file](#optionsnode).11301131When aborted, [`error.isGracefullyCanceled`](#errorisgracefullycanceled) becomes `true`.11321133[More info.](termination.md#graceful-termination)

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

lines 1134–1136why, one step back
1134
1135### options.forceKillAfterDelay1136

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

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

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

lines 1139–1140why, one step back
1139
1140If 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 1141–1142why, one step back
1141
1142When this happens, [`error.isForcefullyTerminated`](#errorisforcefullyterminated) becomes `true`.

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

lines 1143–1147why, one step back
1143
1144[More info.](termination.md#forceful-termination)11451146### options.killSignal1147

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

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

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

lines 1150–1158why, one step back
1150
1151Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.11521153This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).11541155[More info.](termination.md#default-signal)11561157### options.detached1158

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–1167why, one step back
1161
1162Run the subprocess independently from the current process.11631164[More info.](environment.md#background-subprocess)11651166### options.cleanup1167

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

lines 1168–1169why, one step back
1168_Type:_ `boolean`\
1169_Default:_ `true`

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

lines 1170–1174why, one step back
1170
1171Kill the subprocess when the current process exits.11721173[More info.](termination.md#current-process-exit)1174

Add `killDescendants` option to also terminate descendant processes (#1256)Sindre Sorhusbefore adoption84fa0ec

lines 1175–1185why, one step back
1175### options.killDescendants
11761177_Type:_ `boolean`\1178_Default:_ `false`11791180When the subprocess is terminated by Execa, also terminate all of its descendant processes, instead of only the subprocess itself.11811182This is useful when the subprocess spawns its own processes, such as when using the [`shell`](#optionsshell) option.11831184On Unix, this spawns the subprocess in its own [process group](https://en.wikipedia.org/wiki/Process_group). On Windows, this uses [`taskkill`](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/taskkill).1185

Fix `killDescendants` signaling unrelated processes once Execa is done with the subprocessSindre Sorhusbefore adoption9c5c71c

line 1186why, one step back
1186This is best-effort: descendant processes that create their own process group or session are not terminated. Also, descendants are not terminated once Execa is done with the subprocess, or on Windows once the subprocess exited, since its PID might then belong to an unrelated process.

Add `killDescendants` option to also terminate descendant processes (#1256)Sindre Sorhusbefore adoption84fa0ec

lines 1187–1189why, one step back
1187
1188[More info.](termination.md#killing-descendant-processes)1189

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

lines 1190–1191why, one step back
1190### options.uid
1191

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

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

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

lines 1194–1200why, one step back
1194
1195Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.11961197[More info.](windows.md#uid-and-gid)11981199### options.gid1200

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

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

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

lines 1203–1209why, one step back
1203
1204Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.12051206[More info.](windows.md#uid-and-gid)12071208### options.argv01209

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

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

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

lines 1212–1216why, one step back
1212
1213Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.12141215### options.windowsHide1216

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

lines 1217–1218why, one step back
1217_Type:_ `boolean`\
1218_Default:_ `true`

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

lines 1219–1225why, one step back
1219
1220On Windows, do not create a new console window.12211222[More info.](windows.md#console-window)12231224### options.windowsVerbatimArguments1225

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

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

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

lines 1228–1230why, one step back
1228
1229If `false`, escapes the command arguments on Windows.1230

Improve documentation for `windowsVerbatimArguments` (#1149)ehmickybefore adoptionc4cb62a

line 1231why, one step back
1231[More info.](windows.md#escaping)

Allow `verbose` option to be a function for custom logging (#1130)ehmickybefore adoption8daf348

lines 1232–1309why, one step back
1232
1233## Verbose function12341235_Type_: `(string, VerboseObject) => string | undefined`12361237Function passed to the [`verbose`](#optionsverbose) option to customize logging.12381239[More info.](debugging.md#custom-logging)12401241### Verbose object12421243_Type_: `VerboseObject` or `SyncVerboseObject`12441245Subprocess event object, for logging purpose, using the [`verbose`](#optionsverbose) option.12461247#### verboseObject.type12481249_Type_: `string`12501251Event type. This can be:1252- `'command'`: subprocess start1253- `'output'`: `stdout`/`stderr` [output](output.md#stdout-and-stderr)1254- `'ipc'`: IPC [output](ipc.md#retrieve-all-messages)1255- `'error'`: subprocess [failure](errors.md#subprocess-failure)1256- `'duration'`: subprocess success or failure12571258#### verboseObject.message12591260_Type_: `string`12611262Depending on [`verboseObject.type`](#verboseobjecttype), this is:1263- `'command'`: the [`result.escapedCommand`](#resultescapedcommand)1264- `'output'`: one line from [`result.stdout`](#resultstdout) or [`result.stderr`](#resultstderr)1265- `'ipc'`: one IPC message from [`result.ipcOutput`](#resultipcoutput)1266- `'error'`: the [`error.shortMessage`](#errorshortmessage)1267- `'duration'`: the [`result.durationMs`](#resultdurationms)12681269#### verboseObject.escapedCommand12701271_Type_: `string`12721273The file and [arguments](input.md#command-arguments) that were run. This is the same as [`result.escapedCommand`](#resultescapedcommand).12741275#### verboseObject.options12761277_Type_: [`Options`](#options-1) or [`SyncOptions`](#options-1)12781279The [options](#options-1) passed to the subprocess.12801281#### verboseObject.commandId12821283_Type_: `string`12841285Serial number identifying the subprocess within the current process. It is incremented from `'0'`.12861287This is helpful when multiple subprocesses are running at the same time.12881289This is similar to a [PID](https://en.wikipedia.org/wiki/Process_identifier) except it has no maximum limit, which means it never repeats. Also, it is usually shorter.12901291#### verboseObject.timestamp12921293_Type_: `Date`12941295Event date/time.12961297#### verboseObject.result12981299_Type_: [`Result`](#result), [`SyncResult`](#result) or `undefined`13001301Subprocess [result](#result).13021303This is `undefined` if [`verboseObject.type`](#verboseobjecttype) is `'command'`, `'output'` or `'ipc'`.13041305#### verboseObject.piped13061307_Type_: `boolean`13081309Whether another subprocess is [piped](pipe.md) into this subprocess. This is `false` when [`result.pipedFrom`](#resultfailed) is empty.

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

lines 1310–1320why, one step back
1310
1311## Transform options13121313A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.13141315A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.13161317[More info.](transform.md)13181319### transformOptions.transform1320

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

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

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

lines 1322–1328why, one step back
1322
1323Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.13241325More info [here](transform.md#summary) and [there](transform.md#sharing-state).13261327### transformOptions.final1328

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

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

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

lines 1330–1336why, one step back
1330
1331Create additional lines after the last one.13321333[More info.](transform.md#finalizing)13341335### transformOptions.binary1336

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

lines 1337–1338why, one step back
1337_Type:_ `boolean`\
1338_Default:_ `false`

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

lines 1339–1345why, one step back
1339
1340If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.13411342[More info.](binary.md#transforms)13431344### transformOptions.preserveNewlines1345

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

lines 1346–1347why, one step back
1346_Type:_ `boolean`\
1347_Default:_ `false`

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

line 1348why, one step back
1348

Type the `std*` generator transform `chunk` argument (#1247)Sindre Sorhusbefore adoption0a7b4f8

line 1349why, one step back
1349If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produce a single line.

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

lines 1350–1354why, one step back
1350
1351[More info.](lines.md#transforms)13521353### transformOptions.objectMode1354

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

lines 1355–1356why, one step back
1355_Type:_ `boolean`\
1356_Default:_ `false`

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

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