api.md
This file
Path
docs/api.md
1,202 lines · 47.1 KiB · Markdown
Last changed by
Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
History of this fileTake it
Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1–17why, one step back1<picture>2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 📔 API reference89This lists all available [methods](#methods) and their [options](#options). This also describes the properties of the [subprocess](#subprocess), [result](#result) and [error](#execaerror) they return.1011## Methods1213### execa(file, arguments?, options?)1415`file`: `string | URL`\16`arguments`: `string[]`\17`options`: [`Options`](#options)\Rename some types (#1009)ehmickybefore adoption2ef9186
line 18why, one step back18_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 19–28why, one step back1920Executes a command using `file ...arguments`.2122More info on the [syntax](execution.md#array-syntax) and [escaping](escaping.md#array-syntax).2324### execa\`command\`25### execa(options)\`command\`2627`command`: `string`\28`options`: [`Options`](#options)\Rename some types (#1009)ehmickybefore adoption2ef9186
line 29why, one step back29_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 30–46why, one step back3031Executes a command. `command` is a [template string](execution.md#template-string-syntax) that includes both the `file` and its `arguments`.3233More info on the [syntax](execution.md#template-string-syntax) and [escaping](escaping.md#template-string-syntax).3435### execa(options)3637`options`: [`Options`](#options)\38_Returns_: [`execa`](#execafile-arguments-options)3940Returns a new instance of Execa but with different default [`options`](#options). Consecutive calls are merged to previous ones.4142[More info.](execution.md#globalshared-options)4344### execaSync(file, arguments?, options?)45### execaSync\`command\`46Rename some types (#1009)ehmickybefore adoption2ef9186
line 47why, one step back47_Returns_: [`SyncResult`](#return-value)Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 48why, one step back48Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 49–59why, one step back49Same as [`execa()`](#execafile-arguments-options) but synchronous.5051Returns or throws a subprocess [`result`](#result). The [`subprocess`](#subprocess) is not returned: its methods and properties are not available.5253[More info.](execution.md#synchronous-execution)5455### $(file, arguments?, options?)5657`file`: `string | URL`\58`arguments`: `string[]`\59`options`: [`Options`](#options)\Rename some types (#1009)ehmickybefore adoption2ef9186
line 60why, one step back60_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 61–74why, one step back6162Same as [`execa()`](#execafile-arguments-options) but using [script-friendly default options](scripts.md#script-files).6364Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options). It can also be [run synchronously](#execasyncfile-arguments-options) using `$.sync()` or `$.s()`.6566This is the preferred method when executing multiple commands in a script file.6768[More info.](scripts.md)6970### execaNode(scriptPath, arguments?, options?)7172`scriptPath`: `string | URL`\73`arguments`: `string[]`\74`options`: [`Options`](#options)\Rename some types (#1009)ehmickybefore adoption2ef9186
line 75why, one step back75_Returns_: [`ResultPromise`](#return-value)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 76–85why, one step back7677Same as [`execa()`](#execafile-arguments-options) but using the [`node: true`](#optionsnode) option.78Executes a Node.js file using `node scriptPath ...arguments`.7980Just like `execa()`, this can use the [template string syntax](execution.md#template-string-syntax) or [bind options](execution.md#globalshared-options).8182This is the preferred method when executing Node.js files.8384[More info.](node.md)85Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 86why, one step back86### parseCommandString(command)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 87–88why, one step back8788`command`: `string`\Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 89why, one step back89_Returns_: `string[]`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 90why, one step back90Add `parseCommandString()` (#1054)ehmickybefore adoptionb9474c3
line 91why, one step back91Split a `command` string into an array. For example, `'npm run build'` returns `['npm', 'run', 'build']` and `'argument otherArgument'` returns `['argument', 'otherArgument']`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 92–94why, one step back9293[More info.](escaping.md#user-defined-input)94Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 95why, one step back95### sendMessage(message, sendMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 96–97why, one step back9697`message`: [`Message`](ipc.md#message-type)\Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 98why, one step back98`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 99–106why, one step back99_Returns_: `Promise<void>`100101Send a `message` to the parent process.102103This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.104105[More info.](ipc.md#exchanging-messages)106Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
lines 107–119why, one step back107#### sendMessageOptions108109_Type_: `object`110111#### sendMessageOptions.strict112113_Type_: `boolean`\114_Default_: `false`115116Throw when the other process is not receiving or listening to messages.117118[More info.](ipc.md#ensure-messages-are-received)119Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 120why, one step back120### getOneMessage(getOneMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 121why, one step back121Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 122why, one step back122`getOneMessageOptions`: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 123–130why, one step back123_Returns_: [`Promise<Message>`](ipc.md#message-type)124125Receive a single `message` from the parent process.126127This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.128129[More info.](ipc.md#exchanging-messages)130Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
lines 131–142why, one step back131#### getOneMessageOptions132133_Type_: `object`134135#### getOneMessageOptions.filter136137_Type_: [`(Message) => boolean`](ipc.md#message-type)138139Ignore any `message` that returns `false`.140141[More info.](ipc.md#filter-messages)142Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
line 143why, one step back143#### getOneMessageOptions.referenceAdd promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 144why, one step back144Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
lines 145–154why, one step back145_Type_: `boolean`\146_Default_: `true`147148Keep the subprocess alive while `getOneMessage()` is waiting.149150[More info.](ipc.md#keeping-the-subprocess-alive)151152### getEachMessage(getEachMessageOptions?)153154`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 155–162why, one step back155_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)156157Iterate over each `message` from the parent process.158159This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.160161[More info.](ipc.md#listening-to-messages)162Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
lines 163–175why, one step back163#### getEachMessageOptions164165_Type_: `object`166167#### getEachMessageOptions.reference168169_Type_: `boolean`\170_Default_: `true`171172Keep the subprocess alive while `getEachMessage()` is waiting.173174[More info.](ipc.md#keeping-the-subprocess-alive)175Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 176–185why, one step back176### getCancelSignal()177178_Returns_: [`Promise<AbortSignal>`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)179180Retrieves the [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) shared by the [`cancelSignal`](#optionscancelsignal) option.181182This can only be called inside a subprocess. This requires the [`gracefulCancel`](#optionsgracefulcancel) option to be `true`.183184[More info.](termination.md#graceful-termination)185Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 186why, one step back186## Return valueMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 187why, one step back187Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
lines 188–189why, one step back188_TypeScript:_ [`ResultPromise`](typescript.md)\189_Type:_ `Promise<object> | Subprocess`Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 190why, one step back190Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 191why, one step back191The return value of all [asynchronous methods](#methods) is both:Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 192–193why, one step back192- the [subprocess](#subprocess).193- 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 194–196why, one step back194195[More info.](execution.md#subprocess)196Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 197–198why, one step back197## Subprocess198Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 199why, one step back199_TypeScript:_ [`Subprocess`](typescript.md)Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
lines 200–202why, one step back200201[`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following methods and properties.202Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 203–245why, one step back203### subprocess\[Symbol.asyncIterator\]()204205_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)206207Subprocesses are [async iterables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator). They iterate over each output line.208209[More info.](lines.md#progressive-splitting)210211### subprocess.iterable(readableOptions?)212213`readableOptions`: [`ReadableOptions`](#readableoptions)\214_Returns_: [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)215216Same as [`subprocess[Symbol.asyncIterator]`](#subprocesssymbolasynciterator) except [options](#readableoptions) can be provided.217218[More info.](lines.md#progressive-splitting)219220### subprocess.pipe(file, arguments?, options?)221222`file`: `string | URL`\223`arguments`: `string[]`\224`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\225_Returns_: [`Promise<Result>`](#result)226227[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.228229This follows the same syntax as [`execa(file, arguments?, options?)`](#execafile-arguments-options) except both [regular options](#options) and [pipe-specific options](#pipeoptions) can be specified.230231[More info.](pipe.md#array-syntax)232233### subprocess.pipe\`command\`234### subprocess.pipe(options)\`command\`235236`command`: `string`\237`options`: [`Options`](#options) and [`PipeOptions`](#pipeoptions)\238_Returns_: [`Promise<Result>`](#result)239240Like [`subprocess.pipe(file, arguments?, options?)`](#subprocesspipefile-arguments-options) but using a [`command` template string](scripts.md#piping-stdout-to-another-command) instead. This follows the same syntax as `execa` [template strings](execution.md#template-string-syntax).241242[More info.](pipe.md#template-string-syntax)243244### subprocess.pipe(secondSubprocess, pipeOptions?)245Rename some types (#1009)ehmickybefore adoption2ef9186
line 246why, one step back246`secondSubprocess`: [`ResultPromise`](#return-value)\Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 247–249why, one step back247`pipeOptions`: [`PipeOptions`](#pipeoptions)\248_Returns_: [`Promise<Result>`](#result)249Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 250why, one step back250Like [`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 251–255why, one step back251252[More info.](pipe.md#advanced-syntax)253254#### pipeOptions255Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 256why, one step back256_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 257–259why, one step back257258#### pipeOptions.from259Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 260–261why, one step back260_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\261_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 262–270why, one step back262263Which stream to pipe from the source subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.264265`"all"` pipes both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.266267[More info.](pipe.md#source-file-descriptor)268269#### pipeOptions.to270Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 271–272why, one step back271_Type:_ `"stdin" | "fd3" | "fd4" | ...`\272_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 273–279why, one step back273274Which [stream](#subprocessstdin) to pipe to the destination subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.275276[More info.](pipe.md#destination-file-descriptor)277278#### pipeOptions.unpipeSignal279Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 280why, one step back280_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 281–292why, one step back281282Unpipe the subprocess when the signal aborts.283284[More info.](pipe.md#unpipe)285286### subprocess.kill(signal, error?)287### subprocess.kill(error?)288289`signal`: `string | number`\290`error`: `Error`\291_Returns_: `boolean`292Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 293why, one step back293Sends 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 294–302why, one step back294295This returns `false` when the signal could not be sent, for example when the subprocess has already exited.296297When 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).298299[More info.](termination.md)300301### subprocess.pid302Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 303why, one step back303_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 304–310why, one step back304305Process identifier ([PID](https://en.wikipedia.org/wiki/Process_identifier)).306307This is `undefined` if the subprocess failed to spawn.308309[More info.](termination.md#inter-process-termination)310Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 311why, one step back311### subprocess.sendMessage(message, sendMessageOptions)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 312why, one step back312Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 313why, one step back313`message`: [`Message`](ipc.md#message-type)\Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 314why, one step back314`sendMessageOptions`: [`SendMessageOptions`](#sendmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 315why, one step back315_Returns_: `Promise<void>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 316why, one step back316Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 317why, one step back317Send a `message` to the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 318why, one step back318Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 319why, one step back319This 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 320–322why, one step back320321[More info.](ipc.md#exchanging-messages)322Add `filter` option to `getOneMessage()` (#1076)ehmickybefore adoption571e052
line 323why, one step back323### subprocess.getOneMessage(getOneMessageOptions?)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 324why, one step back324Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 325why, one step back325`getOneMessageOptions`: [`GetOneMessageOptions`](#getonemessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 326why, one step back326_Returns_: [`Promise<Message>`](ipc.md#message-type)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 327why, one step back327Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 328why, one step back328Receive a single `message` from the subprocess.Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 329why, one step back329Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 330why, one step back330This 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 331–333why, one step back331332[More info.](ipc.md#exchanging-messages)333Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
line 334why, one step back334### subprocess.getEachMessage(getEachMessageOptions?)Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
line 335why, one step back335Add `reference` option to `getOneMessage()` and `getEachMessage()` (#1107)ehmickybefore adoptionff02af6
line 336why, one step back336`getEachMessageOptions`: [`GetEachMessageOptions`](#geteachmessageoptions)\Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 337–344why, one step back337_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)338339Iterate over each `message` from the subprocess.340341This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.342343[More info.](ipc.md#listening-to-messages)344Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 345–346why, one step back345### subprocess.stdin346Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 347why, one step back347_Type:_ [`Writable | null`](https://nodejs.org/api/stream.html#class-streamwritable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 348–356why, one step back348349The subprocess [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)) as a stream.350351This 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).352353[More info.](streams.md#manual-streaming)354355### subprocess.stdout356Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 357why, one step back357_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 358–366why, one step back358359The subprocess [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)) as a stream.360361This 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`.362363[More info.](streams.md#manual-streaming)364365### subprocess.stderr366Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 367why, one step back367_Type:_ [`Readable | null`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 368–376why, one step back368369The subprocess [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)) as a stream.370371This 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`.372373[More info.](streams.md#manual-streaming)374375### subprocess.all376Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 377why, one step back377_Type:_ [`Readable | undefined`](https://nodejs.org/api/stream.html#class-streamreadable)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 378–388why, one step back378379Stream combining/interleaving [`subprocess.stdout`](#subprocessstdout) and [`subprocess.stderr`](#subprocessstderr).380381This requires the [`all`](#optionsall) option to be `true`.382383This 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`.384385More info on [interleaving](output.md#interleaved-output) and [streaming](streams.md#manual-streaming).386387### subprocess.stdio388Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 389why, one step back389_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 390–407why, one step back390391The subprocess [`stdin`](#subprocessstdin), [`stdout`](#subprocessstdout), [`stderr`](#subprocessstderr) and [other files descriptors](#optionsstdio) as an array of streams.392393Each 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`.394395[More info.](streams.md#manual-streaming)396397### subprocess.readable(readableOptions?)398399`readableOptions`: [`ReadableOptions`](#readableoptions)\400_Returns_: [`Readable`](https://nodejs.org/api/stream.html#class-streamreadable) Node.js stream401402Converts the subprocess to a readable stream.403404[More info.](streams.md#converting-a-subprocess-to-a-stream)405406#### readableOptions407Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 408why, one step back408_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 409–411why, one step back409410#### readableOptions.from411Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 412–413why, one step back412_Type:_ `"stdout" | "stderr" | "all" | "fd3" | "fd4" | ...`\413_Default:_ `"stdout"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 414–422why, one step back414415Which stream to read from the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.416417`"all"` reads both [`stdout`](#subprocessstdout) and [`stderr`](#subprocessstderr). This requires the [`all`](#optionsall) option to be `true`.418419[More info.](streams.md#different-file-descriptor)420421#### readableOptions.binary422Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 423–424why, one step back423_Type:_ `boolean`\424_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 425–435why, one step back425426If `false`, iterates over lines. Each line is a string.427428If `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)).429430This is always `true` when the [`encoding`](#optionsencoding) option is binary.431432More info for [iterables](binary.md#iterable) and [streams](binary.md#streams).433434#### readableOptions.preserveNewlines435Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 436–437why, one step back436_Type:_ `boolean`\437_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 438–453why, one step back438439If both this option and the [`binary`](#readableoptionsbinary) option is `false`, [newlines](https://en.wikipedia.org/wiki/Newline) are stripped from each line.440441[More info.](lines.md#iterable)442443### subprocess.writable(writableOptions?)444445`writableOptions`: [`WritableOptions`](#writableoptions)\446_Returns_: [`Writable`](https://nodejs.org/api/stream.html#class-streamwritable) Node.js stream447448Converts the subprocess to a writable stream.449450[More info.](streams.md#converting-a-subprocess-to-a-stream)451452#### writableOptions453Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 454why, one step back454_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 455–457why, one step back455456#### writableOptions.to457Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 458–459why, one step back458_Type:_ `"stdin" | "fd3" | "fd4" | ...`\459_Default:_ `"stdin"`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 460–475why, one step back460461Which [stream](#subprocessstdin) to write to the subprocess. A [file descriptor](https://en.wikipedia.org/wiki/File_descriptor) like `"fd3"` can also be passed.462463[More info.](streams.md#different-file-descriptor)464465### subprocess.duplex(duplexOptions?)466467`duplexOptions`: [`ReadableOptions | WritableOptions`](#readableoptions)\468_Returns_: [`Duplex`](https://nodejs.org/api/stream.html#class-streamduplex) Node.js stream469470Converts the subprocess to a duplex stream.471472[More info.](streams.md#converting-a-subprocess-to-a-stream)473474## Result475Improve documentation of signal handling (#1105)ehmickybefore adoption01a4b42
line 476why, one step back476_TypeScript:_ [`Result`](typescript.md) or [`SyncResult`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 477why, one step back477_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 478why, one step back478Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 479why, one step back479[Result](execution.md#result) of a subprocess successful execution.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 480–484why, one step back480481When the subprocess [fails](errors.md#subprocess-failure), it is rejected with an [`ExecaError`](#execaerror) instead.482483### result.stdout484Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 485why, one step back485_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 486–496why, one step back486487The output of the subprocess on [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)).488489This 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`.490491This 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).492493[More info.](output.md#stdout-and-stderr)494495### result.stderr496Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 497why, one step back497_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 498–508why, one step back498499The output of the subprocess on [`stderr`](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)).500501This 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`.502503This 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).504505[More info.](output.md#stdout-and-stderr)506507### result.all508Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 509why, one step back509_Type:_ `string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 510–522why, one step back510511The output of the subprocess with [`result.stdout`](#resultstdout) and [`result.stderr`](#resultstderr) interleaved.512513This requires the [`all`](#optionsall) option to be `true`.514515This 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`.516517This 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).518519[More info.](output.md#interleaved-output)520521### result.stdio522Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 523why, one step back523_Type:_ `Array<string | Uint8Array | string[] | Uint8Array[] | unknown[] | undefined>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 524–532why, one step back524525The output of the subprocess on [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) and [other file descriptors](#optionsstdio).526527Items 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`.528529Items are arrays when their corresponding `stdio` option is a [transform in object mode](transform.md#object-mode).530531[More info.](output.md#additional-file-descriptors)532Rename `result.ipc` to `result.ipcOutput` (#1075)ehmickybefore adoptionae9b360
line 533why, one step back533### result.ipcOutputAdd `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 534why, one step back534Fix type of `result.ipc` (#1071)ehmickybefore adoption69152ec
line 535why, one step back535_Type_: [`Message[]`](ipc.md#message-type)Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 536why, one step back536Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 537why, one step back537All the messages [sent by the subprocess](#sendmessagemessage-sendmessageoptions) to the current process.Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
lines 538–542why, one step back538539This is empty unless the [`ipc`](#optionsipc) option is `true`. Also, this is empty if the [`buffer`](#optionsbuffer) option is `false`.540541[More info.](ipc.md#retrieve-all-messages)542Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 543–544why, one step back543### result.pipedFrom544Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 545why, one step back545_Type:_ [`Array<Result | ExecaError>`](#result)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 546–554why, one step back546547[Results](#result) of the other subprocesses that were piped into this subprocess.548549This array is initially empty and is populated each time the [`subprocess.pipe()`](#subprocesspipefile-arguments-options) method resolves.550551[More info.](pipe.md#result)552553### result.command554Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 555why, one step back555_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 556–562why, one step back556557The file and [arguments](input.md#command-arguments) that were run.558559[More info.](debugging.md#command)560561### result.escapedCommand562Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 563why, one step back563_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 564–570why, one step back564565Same as [`command`](#resultcommand) but escaped.566567[More info.](debugging.md#command)568569### result.cwd570Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 571why, one step back571_Type:_ `string`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 572–578why, one step back572573The [current directory](#optionscwd) in which the command was run.574575[More info.](environment.md#current-directory)576577### result.durationMs578Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 579why, one step back579_Type:_ `number`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 580–586why, one step back580581Duration of the subprocess, in milliseconds.582583[More info.](debugging.md#duration)584585### result.failed586Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 587why, one step back587_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 588–590why, one step back588589Whether the subprocess failed to run.590Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 591–592why, one step back591When this is `true`, the result is an [`ExecaError`](#execaerror) instance with additional error-related properties.592Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 593–594why, one step back593[More info.](errors.md#subprocess-failure)594Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 595–596why, one step back595## ExecaError596## ExecaSyncErrorMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 597why, one step back597Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 598why, one step back598_Type:_ `Error`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 599–609why, one step back599600Result of a subprocess [failed execution](errors.md#subprocess-failure).601602This error is thrown as an exception. If the [`reject`](#optionsreject) option is false, it is returned instead.603604This has the same shape as [successful results](#result), with the following additional properties.605606[More info.](errors.md)607608### error.message609Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 610why, one step back610_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 611–617why, one step back611612Error message when the subprocess [failed](errors.md#subprocess-failure) to run.613614[More info.](errors.md#error-message)615616### error.shortMessage617Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 618why, one step back618_Type:_ `string`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 619–625why, one step back619620This is the same as [`error.message`](#errormessage) except it does not include the subprocess [output](output.md).621622[More info.](errors.md#error-message)623624### error.originalMessage625Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 626why, one step back626_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 627–633why, one step back627628Original error message. This is the same as [`error.message`](#errormessage) excluding the subprocess [output](output.md) and some additional information added by Execa.629630[More info.](errors.md#error-message)631632### error.cause633Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 634why, one step back634_Type:_ `unknown | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 635–643why, one step back635636Underlying error, if there is one. For example, this is set by [`subprocess.kill(error)`](#subprocesskillerror).637638This is usually an `Error` instance.639640[More info.](termination.md#error-message-and-stack-trace)641642### error.code643Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 644why, one step back644_Type:_ `string | undefined`Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
lines 645–649why, one step back645646Node.js-specific [error code](https://nodejs.org/api/errors.html#errorcode), when available.647648### error.timedOut649Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 650why, one step back650_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 651–655why, one step back651652Whether the subprocess timed out due to the [`timeout`](#optionstimeout) option.653654[More info.](termination.md#timeout)655Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 656why, one step back656### error.isCanceledMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 657why, one step back657Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 658why, one step back658_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 659–663why, one step back659660Whether the subprocess was canceled using the [`cancelSignal`](#optionscancelsignal) option.661662[More info.](termination.md#canceling)663Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 664–671why, one step back664### error.isGracefullyCanceled665666_Type:_ `boolean`667668Whether the subprocess was canceled using both the [`cancelSignal`](#optionscancelsignal) and the [`gracefulCancel`](#optionsgracefulcancel) options.669670[More info.](termination.md#graceful-termination)671Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 672why, one step back672### error.isMaxBufferMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 673why, one step back673Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 674why, one step back674_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 675–679why, one step back675676Whether the subprocess failed because its output was larger than the [`maxBuffer`](#optionsmaxbuffer) option.677678[More info.](output.md#big-output)679Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 680why, one step back680### error.isTerminatedMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 681why, one step back681Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 682why, one step back682_Type:_ `boolean`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 683–689why, one step back683684Whether the subprocess was terminated by a [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) sent by either:685- The current process.686- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).687688[More info.](termination.md#signal-name-and-description)689Add `error.isForcefullyTerminated` (#1111)ehmickybefore adoptione69985d
lines 690–697why, one step back690### error.isForcefullyTerminated691692_Type:_ `boolean`693694Whether the subprocess was terminated by the [`SIGKILL`](termination.md#sigkill) signal sent by the [`forceKillAfterDelay`](#optionsforcekillafterdelay) option.695696[More info.](termination.md#forceful-termination)697Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 698why, one step back698### error.exitCodeMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 699why, one step back699Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 700why, one step back700_Type:_ `number | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 701–703why, one step back701702The numeric [exit code](https://en.wikipedia.org/wiki/Exit_status) of the subprocess that was run.703Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 704why, one step back704This 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 705–707why, one step back705706[More info.](errors.md#exit-code)707Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 708why, one step back708### error.signalMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 709why, one step back709Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 710why, one step back710_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 711–719why, one step back711712The name of the [signal](termination.md#signal-termination) (like [`SIGTERM`](termination.md#sigterm)) that terminated the subprocess, sent by either:713- The current process.714- [Another process](termination.md#inter-process-termination). This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).715716If a signal terminated the subprocess, this property is defined and included in the [error message](#errormessage). Otherwise it is `undefined`.717718[More info.](termination.md#signal-name-and-description)719Improve documentation of `error.*` fields (#1006)ehmickybefore adoption4ee0dec
line 720why, one step back720### error.signalDescriptionMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 721why, one step back721Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 722why, one step back722_Type:_ `string | undefined`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 723–731why, one step back723724A human-friendly description of the [signal](termination.md#signal-termination) that was used to terminate the subprocess.725726If 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.727728[More info.](termination.md#signal-name-and-description)729730## Options731Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 732why, one step back732_TypeScript:_ [`Options`](typescript.md) or [`SyncOptions`](typescript.md\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 733why, one step back733_Type:_ `object`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 734–740why, one step back734735This lists all options for [`execa()`](#execafile-arguments-options) and the [other methods](#methods).736737The 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).738739### options.preferLocal740Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 741–742why, one step back741_Type:_ `boolean`\742_Default:_ `true` with [`$`](#file-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 743–749why, one step back743744Prefer locally installed binaries when looking for a binary to execute.745746[More info.](environment.md#local-binaries)747748### options.localDir749Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 750–751why, one step back750_Type:_ `string | URL`\751_Default:_ [`cwd`](#optionscwd) optionMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 752–758why, one step back752753Preferred path to find locally installed binaries, when using the [`preferLocal`](#optionspreferlocal) option.754755[More info.](environment.md#local-binaries)756757### options.node758Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 759–760why, one step back759_Type:_ `boolean`\760_Default:_ `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 761–763why, one step back761762If `true`, runs with Node.js. The first argument must be a Node.js file.763Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
lines 764–765why, one step back764The 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.765Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 766–769why, one step back766[More info.](node.md)767768### options.nodeOptions769Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 770why, one step back770_Type:_ `string[]`\Improve the documentation of the `node`/`nodePath`/`nodeOptions` options (#1011)ehmickybefore adoption4878db5
line 771why, one step back771_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 772–780why, one step back772773List of [CLI flags](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#optionsnodepath).774775Requires the [`node`](#optionsnode) option to be `true`.776777[More info.](node.md#nodejs-cli-flags)778779### options.nodePath780Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 781–782why, one step back781_Type:_ `string | URL`\782_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 783–791why, one step back783784Path to the Node.js executable.785786Requires the [`node`](#optionsnode) option to be `true`.787788[More info.](node.md#nodejs-version)789790### options.shell791Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 792–793why, one step back792_Type:_ `boolean | string | URL`\793_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 794–804why, one step back794795If `true`, runs the command inside of a [shell](https://en.wikipedia.org/wiki/Shell_(computing)).796797Uses [`/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.798799We [recommend against](shell.md#avoiding-shells) using this option.800801[More info.](shell.md)802803### options.cwd804Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 805–806why, one step back805_Type:_ `string | URL`\806_Default:_ `process.cwd()`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 807–815why, one step back807808Current [working directory](https://en.wikipedia.org/wiki/Working_directory) of the subprocess.809810This is also used to resolve the [`nodePath`](#optionsnodepath) option when it is a relative path.811812[More info.](environment.md#current-directory)813814### options.env815Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 816–817why, one step back816_Type:_ `object`\817_Default:_ [`process.env`](https://nodejs.org/api/process.html#processenv)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 818–826why, one step back818819[Environment variables](https://en.wikipedia.org/wiki/Environment_variable).820821Unless the [`extendEnv`](#optionsextendenv) option is `false`, the subprocess also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).822823[More info.](input.md#environment-variables)824825### options.extendEnv826Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 827–828why, one step back827_Type:_ `boolean`\828_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 829–836why, one step back829830If `true`, the subprocess uses both the [`env`](#optionsenv) option and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).831If `false`, only the `env` option is used, not `process.env`.832833[More info.](input.md#environment-variables)834835### options.input836Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 837why, one step back837_Type:_ `string | Uint8Array | stream.Readable`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 838–846why, one step back838839Write some input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).840841See also the [`inputFile`](#optionsinputfile) and [`stdin`](#optionsstdin) options.842843[More info.](input.md#string-input)844845### options.inputFile846Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 847why, one step back847_Type:_ `string | URL`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 848–856why, one step back848849Use a file as input to the subprocess' [`stdin`](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)).850851See also the [`input`](#optionsinput) and [`stdin`](#optionsstdin) options.852853[More info.](input.md#file-input)854855### options.stdin856Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 857why, one step back857_TypeScript:_ [`StdinOption`](typescript.md) or [`StdinSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 858–859why, one step back858_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)\859_Default:_ `'inherit'` with [`$`](#file-arguments-options), `'pipe'` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 860–868why, one step back860861How 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).862863This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.864865More info on [available values](input.md), [streaming](streams.md) and [transforms](transform.md).866867### options.stdout868Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 869why, one step back869_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 870–871why, one step back870_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)\871_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 872–880why, one step back872873How 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).874875This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.876877More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).878879### options.stderr880Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 881why, one step back881_TypeScript:_ [`StdoutStderrOption`](typescript.md) or [`StdoutStderrSyncOption`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 882–883why, one step back882_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)\883_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 884–892why, one step back884885How 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).886887This can be an [array of values](output.md#multiple-targets) such as `['inherit', 'pipe']` or `[fileUrl, 'pipe']`.888889More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).890891### options.stdio892Add documentation about TypeScript types (#1015)ehmickybefore adoptionf79e058
line 893why, one step back893_TypeScript:_ [`Options['stdio']`](typescript.md) or [`SyncOptions['stdio']`](typescript.md)\Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 894–895why, one step back894_Type:_ `string | Array<string | number | stream.Readable | stream.Writable | ReadableStream | WritableStream | TransformStream | URL | {file: string} | Uint8Array | Iterable<string> | Iterable<Uint8Array> | Iterable<unknown> | AsyncIterable<string | Uint8Array | unknown> | GeneratorFunction<string | Uint8Array | unknown> | AsyncGeneratorFunction<string | Uint8Array | unknown> | {transform: GeneratorFunction | AsyncGeneratorFunction | Duplex | TransformStream}>` (or a tuple of those types)\895_Default:_ `pipe`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 896–906why, one step back896897Like 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'}`.898899A single string can be used [as a shortcut](output.md#shortcut).900901The array can have more than 3 items, to create [additional file descriptors](output.md#additional-file-descriptors) beyond [`stdin`](#optionsstdin)/[`stdout`](#optionsstdout)/[`stderr`](#optionsstderr).902903More info on [available values](output.md), [streaming](streams.md) and [transforms](transform.md).904905### options.all906Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 907–908why, one step back907_Type:_ `boolean`\908_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 909–915why, one step back909910Add a [`subprocess.all`](#subprocessall) stream and a [`result.all`](#resultall) property.911912[More info.](output.md#interleaved-output)913914### options.encoding915Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 916–917why, one step back916_Type:_ `'utf8' | 'utf16le' | 'buffer' | 'hex' | 'base64' | 'base64url' | 'latin1' | 'ascii'`\917_Default:_ `'utf8'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 918–930why, one step back918919If 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).920921If it outputs binary data instead, this should be either:922- `'buffer'`: returns the binary output as an [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).923- [`'hex'`](https://en.wikipedia.org/wiki/Hexadecimal), [`'base64'`](https://en.wikipedia.org/wiki/Base64), [`'base64url'`](https://en.wikipedia.org/wiki/Base64#URL_applications), [`'latin1'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) or [`'ascii'`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings): encodes the binary output as a string.924925The output is available with [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr) and [`result.stdio`](#resultstdio).926927[More info.](binary.md)928929### options.lines930Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 931–932why, one step back931_Type:_ `boolean`\932_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 933–943why, one step back933934Set [`result.stdout`](#resultstdout), [`result.stderr`](#resultstdout), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) as arrays of strings, splitting the subprocess' output into lines.935936This cannot be used if the [`encoding`](#optionsencoding) option is [binary](binary.md#binary-output).937938By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).939940[More info.](lines.md#simple-splitting)941942### options.stripFinalNewline943Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 944–945why, one step back944_Type:_ `boolean`\945_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 946–956why, one step back946947Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.948949If the [`lines`](#optionslines) option is true, this applies to each output line instead.950951By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).952953[More info.](lines.md#newlines)954955### options.maxBuffer956Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 957–958why, one step back957_Type:_ `number`\958_Default:_ `100_000_000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 959–963why, one step back959960Largest amount of data allowed on [`stdout`](#resultstdout), [`stderr`](#resultstderr) and [`stdio`](#resultstdio).961962By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).963Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 964–965why, one step back964When reached, [`error.isMaxBuffer`](#errorismaxbuffer) becomes `true`.965Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 966–969why, one step back966[More info.](output.md#big-output)967968### options.buffer969Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 970–971why, one step back970_Type:_ `boolean`\971_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 972–980why, one step back972973When `buffer` is `false`, the [`result.stdout`](#resultstdout), [`result.stderr`](#resultstderr), [`result.all`](#resultall) and [`result.stdio`](#resultstdio) properties are not set.974975By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).976977[More info.](output.md#low-memory)978979### options.ipc980Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 981why, one step back981_Type:_ `boolean`\Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 982why, one step back982_Default:_ `true` if the [`node`](#optionsnode), [`ipcInput`](#optionsipcinput) or [`gracefulCancel`](#optionsgracefulcancel) option is set, `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
line 983why, one step back983Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 984why, one step back984Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage-sendmessageoptions), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 985why, one step back985Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 986–987why, one step back986The subprocess must be a Node.js file.987Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 988–991why, one step back988[More info.](ipc.md)989990### options.serialization991Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 992–993why, one step back992_Type:_ `'json' | 'advanced'`\993_Default:_ `'advanced'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 994–997why, one step back994995Specify the kind of serialization used for sending messages between subprocesses when using the [`ipc`](#optionsipc) option.996997[More info.](ipc.md#message-type)Add `ipcInput` option (#1068)ehmickybefore adoption46cae30
lines 998–1007why, one step back998999### options.ipcInput10001001_Type_: [`Message`](ipc.md#message-type)10021003Sends an IPC message when the subprocess starts.10041005The subprocess must be a [Node.js file](#optionsnode). The value's [type](ipc.md#message-type) depends on the [`serialization`](#optionsserialization) option.10061007More 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 1008–1010why, one step back10081009### options.verbose1010Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1011–1012why, one step back1011_Type:_ `'none' | 'short' | 'full'`\1012_Default:_ `'none'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1013–1015why, one step back10131014If `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.1015Log IPC messages with `verbose: 'full'` (#1063)ehmickybefore adoption839c2fe
line 1016why, one step back1016If `verbose` is `'full'`, the command's [`stdout`](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)), `stderr` and [IPC messages](ipc.md) are also printed.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1017–1023why, one step back10171018By default, this applies to both `stdout` and `stderr`, but [different values can also be passed](output.md#stdoutstderr-specific-options).10191020[More info.](debugging.md#verbose-mode)10211022### options.reject1023Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1024–1025why, one step back1024_Type:_ `boolean`\1025_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 1026why, one step back1026Fix the type of the return value (#1007)ehmickybefore adoption0a13f2b
line 1027why, one step back1027Setting 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 1028–1032why, one step back10281029[More info.](errors.md#preventing-exceptions)10301031### options.timeout1032Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1033–1034why, one step back1033_Type:_ `number`\1034_Default:_ `0`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1035–1037why, one step back10351036If `timeout` is greater than `0`, the subprocess will be [terminated](#optionskillsignal) if it runs for longer than that amount of milliseconds.1037Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 1038why, one step back1038On timeout, [`error.timedOut`](#errortimedout) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1039–1043why, one step back10391040[More info.](termination.md#timeout)10411042### options.cancelSignal1043Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1044why, one step back1044_Type:_ [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)Move API reference to its own page (#996)ehmickybefore adoption7cde496
line 1045why, one step back1045Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 1046why, one step back1046When 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 1047why, one step back1047Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 1048why, one step back1048When aborted, [`error.isCanceled`](#erroriscanceled) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1049–1050why, one step back10491050[More info.](termination.md#canceling)Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 1051–1063why, one step back10511052### options.gracefulCancel10531054_Type:_ `boolean`\1055_Default:_: `false`10561057When 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.10581059The subprocess must be a [Node.js file](#optionsnode).10601061When aborted, [`error.isGracefullyCanceled`](#errorisgracefullycanceled) becomes `true`.10621063[More info.](termination.md#graceful-termination)Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1064–1066why, one step back10641065### options.forceKillAfterDelay1066Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1067–1068why, one step back1067_Type:_ `number | false`\1068_Default:_ `5000`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1069–1070why, one step back10691070If 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 1071–1072why, one step back10711072When this happens, [`error.isForcefullyTerminated`](#errorisforcefullyterminated) becomes `true`.Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1073–1077why, one step back10731074[More info.](termination.md#forceful-termination)10751076### options.killSignal1077Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1078–1079why, one step back1078_Type:_ `string | number`\1079_Default:_ `'SIGTERM'`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1080–1088why, one step back10801081Default [signal](https://en.wikipedia.org/wiki/Signal_(IPC)) used to terminate the subprocess.10821083This can be either a name (like [`'SIGTERM'`](termination.md#sigterm)) or a number (like `9`).10841085[More info.](termination.md#default-signal)10861087### options.detached1088Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1089–1090why, one step back1089_Type:_ `boolean`\1090_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1091–1097why, one step back10911092Run the subprocess independently from the current process.10931094[More info.](environment.md#background-subprocess)10951096### options.cleanup1097Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1098–1099why, one step back1098_Type:_ `boolean`\1099_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1100–1106why, one step back11001101Kill the subprocess when the current process exits.11021103[More info.](termination.md#current-process-exit)11041105### options.uid1106Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1107–1108why, one step back1107_Type:_ `number`\1108_Default:_ current user identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1109–1115why, one step back11091110Sets the [user identifier](https://en.wikipedia.org/wiki/User_identifier) of the subprocess.11111112[More info.](windows.md#uid-and-gid)11131114### options.gid1115Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1116–1117why, one step back1116_Type:_ `number`\1117_Default:_ current group identifierMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1118–1124why, one step back11181119Sets the [group identifier](https://en.wikipedia.org/wiki/Group_identifier) of the subprocess.11201121[More info.](windows.md#uid-and-gid)11221123### options.argv01124Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1125–1126why, one step back1125_Type:_ `string`\1126_Default:_ file being executedMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1127–1131why, one step back11271128Value of [`argv[0]`](https://nodejs.org/api/process.html#processargv0) sent to the subprocess.11291130### options.windowsHide1131Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1132–1133why, one step back1132_Type:_ `boolean`\1133_Default:_ `true`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1134–1140why, one step back11341135On Windows, do not create a new console window.11361137[More info.](windows.md#console-window)11381139### options.windowsVerbatimArguments1140Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1141–1142why, one step back1141_Type:_ `boolean`\1142_Default:_ `true` if the [`shell`](#optionsshell) option is `true`, `false` otherwiseMove API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1143–1157why, one step back11431144If `false`, escapes the command arguments on Windows.11451146[More info.](windows.md#cmdexe-escaping)11471148## Transform options11491150A transform or an [array of transforms](transform.md#combining) can be passed to the [`stdin`](#optionsstdin), [`stdout`](#optionsstdout), [`stderr`](#optionsstderr) or [`stdio`](#optionsstdio) option.11511152A transform is either a [generator function](#transformoptionstransform) or a plain object with the following members.11531154[More info.](transform.md)11551156### transformOptions.transform1157Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1158why, one step back1158_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1159–1165why, one step back11591160Map or [filter](transform.md#filtering) the [input](input.md) or [output](output.md) of the subprocess.11611162More info [here](transform.md#summary) and [there](transform.md#sharing-state).11631164### transformOptions.final1165Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
line 1166why, one step back1166_Type:_ `GeneratorFunction<string | Uint8Array | unknown>` | `AsyncGeneratorFunction<string | Uint8Array | unknown>`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1167–1173why, one step back11671168Create additional lines after the last one.11691170[More info.](transform.md#finalizing)11711172### transformOptions.binary1173Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1174–1175why, one step back1174_Type:_ `boolean`\1175_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1176–1182why, one step back11761177If `true`, iterate over arbitrary chunks of `Uint8Array`s instead of line `string`s.11781179[More info.](binary.md#transforms)11801181### transformOptions.preserveNewlines1182Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1183–1184why, one step back1183_Type:_ `boolean`\1184_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1185–1191why, one step back11851186If `true`, keep newlines in each `line` argument. Also, this allows multiple `yield`s to produces a single line.11871188[More info.](lines.md#transforms)11891190### transformOptions.objectMode1191Fix style inconsistency in API reference (#1010)ehmickybefore adoption42bea7f
lines 1192–1193why, one step back1192_Type:_ `boolean`\1193_Default:_ `false`Move API reference to its own page (#996)ehmickybefore adoption7cde496
lines 1194–1202why, one step back11941195If `true`, allow [`transformOptions.transform`](#transformoptionstransform) and [`transformOptions.final`](#transformoptionsfinal) to return any type, not just `string` or `Uint8Array`.11961197[More info.](transform.md#object-mode)11981199<hr>12001201[**Previous**: 🔍 Differences with Bash and zx](bash.md)\1202[**Top**: Table of contents](../readme.md#documentation)