Skip to content
Myr

readme.md

This file

Path

readme.md

944 lines · 35.3 KiB · Markdown

Last changed by

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

History of this file

Take it

The walk stopped after 200 commits: lines older than f1eda9c point at it.

Improve the logo in dark mode (#505)ehmickybefore adoption7a8f5cd

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

3.3.0ehmickybefore adoptionf1eda9c

lines 5–6why, one step back
5<br>
6

Rename `master` branch to `main`Sindre Sorhusbefore adoptionfd3c7be

line 7why, one step back
7[![Coverage Status](https://codecov.io/gh/sindresorhus/execa/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/execa)

3.3.0ehmickybefore adoptionf1eda9c

lines 8–10why, one step back
8
9> Process execution for humans10

Meta tweaksSindre Sorhusbefore adoptiona228eda

lines 11–24why, one step back
11<br>
1213---1415<div align="center">16 <p>17 <p>18 <sup>19 <a href="https://github.com/sponsors/sindresorhus">Sindre's open source work is supported by the community</a>20 </sup>21 </p>22 <sup>Special thanks to:</sup>23 <br>24 <br>

7.2.0Sindre Sorhusbefore adoptiondb58085

line 25why, one step back
25 <a href="https://transloadit.com?utm_source=sindresorhus&utm_medium=referral&utm_campaign=sponsorship&utm_content=execa">

Meta tweaksSindre Sorhusbefore adoptiona228eda

lines 26–40why, one step back
26 <picture>
27 <source width="360" media="(prefers-color-scheme: dark)" srcset="https://sindresorhus.com/assets/thanks/transloadit-logo-dark.svg">28 <source width="360" media="(prefers-color-scheme: light)" srcset="https://sindresorhus.com/assets/thanks/transloadit-logo.svg">29 <img width="360" src="https://sindresorhus.com/assets/thanks/transloadit-logo.svg" alt="Transloadit logo">30 </picture>31 </a>32 <br>33 <br>34 </p>35</div>3637---3839<br>40

3.3.0ehmickybefore adoptionf1eda9c

lines 41–44why, one step back
41## Why
4243This package improves [`child_process`](https://nodejs.org/api/child_process.html) methods with:44

Improve the "Why" section in readme.md (#537)ehmickybefore adoption7c808f1

lines 45–49why, one step back
45- [Promise interface](#execacommandcommand-options).
46- [Scripts interface](#scripts-interface), like `zx`.47- Improved [Windows support](https://github.com/IndigoUnited/node-cross-spawn#why), including [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries.48- Executes [locally installed binaries](#preferlocal) without `npx`.49- [Cleans up](#cleanup) child processes when the parent process ends.

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 50why, one step back
50- Redirect [`stdin`](#stdin)/[`stdout`](#stdout-1)/[`stderr`](#stderr-1) from/to files, streams, iterables, strings, `Uint8Array` or [objects](docs/transform.md#object-mode).

Line-wise transforms (#699)ehmickybefore adoption6dd804f

lines 51–52why, one step back
51- [Transform](docs/transform.md) `stdin`/`stdout`/`stderr` with simple functions.
52- Iterate over [each text line](docs/transform.md#binary-data) output by the process.

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 53why, one step back
53- [Fail-safe process termination](#forcekillafterdelay).

Improve the "Why" section in readme.md (#537)ehmickybefore adoption7c808f1

line 54why, one step back
54- Get [interleaved output](#all) from `stdout` and `stderr` similar to what is printed on the terminal.

3.3.0ehmickybefore adoptionf1eda9c

line 55why, one step back
55- [Strips the final newline](#stripfinalnewline) from the output so you don't have to do `stdout.trim()`.

Improve the "Why" section in readme.md (#537)ehmickybefore adoption7c808f1

lines 56–58why, one step back
56- Convenience methods to pipe processes' [input](#input) and [output](#redirect-output-to-a-file).
57- Can specify file and arguments [as a single string](#execacommandcommand-options) without a shell.58- [Verbose mode](#verbose-mode) for debugging.

3.3.0ehmickybefore adoptionf1eda9c

line 59why, one step back
59- More descriptive errors.

Improve the "Why" section in readme.md (#537)ehmickybefore adoption7c808f1

line 60why, one step back
60- Higher max buffer: 100 MB instead of 1 MB.

3.3.0ehmickybefore adoptionf1eda9c

lines 61–63why, one step back
61
62## Install63

Minor tweaksSindre Sorhusbefore adoption244e87a

lines 64–65why, one step back
64```sh
65npm install execa

3.3.0ehmickybefore adoptionf1eda9c

lines 66–69why, one step back
66```
6768## Usage69

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 70–71why, one step back
70### Promise interface
71

3.3.0ehmickybefore adoptionf1eda9c

line 72why, one step back
72```js

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 73why, one step back
73import {execa} from 'execa';

3.3.0ehmickybefore adoptionf1eda9c

line 74why, one step back
74

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 75–77why, one step back
75const {stdout} = await execa('echo', ['unicorns']);
76console.log(stdout);77//=> 'unicorns'

3.3.0ehmickybefore adoptionf1eda9c

lines 78–79why, one step back
78```
79

Add more documentation for `$` (#533)ehmickybefore adoption9bcfa95

line 80why, one step back
80### Scripts interface

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 81why, one step back
81

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 82why, one step back
82For more information about Execa scripts, please see [this page](docs/scripts.md).

Add more documentation for `$` (#533)ehmickybefore adoption9bcfa95

line 83why, one step back
83

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 84–88why, one step back
84#### Basic
8586```js87import {$} from 'execa';88

Fix semicolons and spaces in documentation examples (#547)ehmickybefore adoptionb260fa4

lines 89–90why, one step back
89const branch = await $`git branch --show-current`;
90await $`dep deploy --branch=${branch}`;

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 91why, one step back
91```

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 92why, one step back
92

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 93–97why, one step back
93#### Multiple arguments
9495```js96import {$} from 'execa';97

Fix semicolons and spaces in documentation examples (#547)ehmickybefore adoptionb260fa4

line 98why, one step back
98const args = ['unicorns', '&', 'rainbows!'];

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 99why, one step back
99const {stdout} = await $`echo ${args}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 100why, one step back
100console.log(stdout);

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 101why, one step back
101//=> 'unicorns & rainbows!'

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 102–112why, one step back
102```
103104#### With options105106```js107import {$} from 'execa';108109await $({stdio: 'inherit'})`echo unicorns`;110//=> 'unicorns'111```112

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 113why, one step back
113#### Shared options

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 114–122why, one step back
114
115```js116import {$} from 'execa';117118const $$ = $({stdio: 'inherit'});119120await $$`echo unicorns`;121//=> 'unicorns'122

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 123why, one step back
123await $$`echo rainbows`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 124–126why, one step back
124//=> 'rainbows'
125```126

Add `verbose` option (#532)ehmickybefore adoption69ce814

lines 127–140why, one step back
127#### Verbose mode
128129```sh130> node file.js131unicorns132rainbows133134> NODE_DEBUG=execa node file.js135[16:50:03.305] echo unicorns136unicorns137[16:50:03.308] echo rainbows138rainbows139```140

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 141why, one step back
141### Input/output

3.3.0ehmickybefore adoptionf1eda9c

line 142why, one step back
142

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 143–144why, one step back
143#### Redirect output to a file
144

3.3.0ehmickybefore adoptionf1eda9c

line 145why, one step back
145```js

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 146why, one step back
146import {execa} from 'execa';

3.3.0ehmickybefore adoptionf1eda9c

line 147why, one step back
147

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

line 148why, one step back
148// Similar to `echo unicorns > stdout.txt` in Bash

Fix documentation about piping from stdin (#536)ehmickybefore adoption4857cc4

line 149why, one step back
149await execa('echo', ['unicorns']).pipeStdout('stdout.txt');

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

lines 150–151why, one step back
150
151// Similar to `echo unicorns 2> stdout.txt` in Bash

Fix documentation about piping from stdin (#536)ehmickybefore adoption4857cc4

line 152why, one step back
152await execa('echo', ['unicorns']).pipeStderr('stderr.txt');

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

lines 153–154why, one step back
153
154// Similar to `echo unicorns &> stdout.txt` in Bash

Fix semicolons and spaces in documentation examples (#547)ehmickybefore adoptionb260fa4

line 155why, one step back
155await execa('echo', ['unicorns'], {all: true}).pipeAll('all.txt');

3.3.0ehmickybefore adoptionf1eda9c

lines 156–157why, one step back
156```
157

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 158why, one step back
158#### Redirect input from a file

Fix documentation about piping from stdin (#536)ehmickybefore adoption4857cc4

lines 159–163why, one step back
159
160```js161import {execa} from 'execa';162163// Similar to `cat < stdin.txt` in Bash

Fix semicolons and spaces in documentation examples (#547)ehmickybefore adoptionb260fa4

line 164why, one step back
164const {stdout} = await execa('cat', {inputFile: 'stdin.txt'});

Fix documentation about piping from stdin (#536)ehmickybefore adoption4857cc4

lines 165–168why, one step back
165console.log(stdout);
166//=> 'unicorns'167```168

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 169why, one step back
169#### Save and pipe output from a child process

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

lines 170–179why, one step back
170
171```js172import {execa} from 'execa';173174const {stdout} = await execa('echo', ['unicorns']).pipeStdout(process.stdout);175// Prints `unicorns`176console.log(stdout);177// Also returns 'unicorns'178```179

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 180why, one step back
180#### Pipe multiple processes

Add `pipeStdout()`-related methods (#531)ehmickybefore adoption06287c8

lines 181–190why, one step back
181
182```js183import {execa} from 'execa';184185// Similar to `echo unicorns | cat` in Bash186const {stdout} = await execa('echo', ['unicorns']).pipeStdout(execa('cat'));187console.log(stdout);188//=> 'unicorns'189```190

3.3.0ehmickybefore adoptionf1eda9c

lines 191–193why, one step back
191### Handling Errors
192193```js

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 194why, one step back
194import {execa} from 'execa';

3.3.0ehmickybefore adoptionf1eda9c

line 195why, one step back
195

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 196–217why, one step back
196// Catching an error
197try {198 await execa('unknown', ['command']);199} catch (error) {200 console.log(error);201 /*202 {203 message: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',204 errno: -2,205 code: 'ENOENT',206 syscall: 'spawn unknown',207 path: 'unknown',208 spawnargs: ['command'],209 originalMessage: 'spawn unknown ENOENT',210 shortMessage: 'Command failed with ENOENT: unknown command spawn unknown ENOENT',211 command: 'unknown command',212 escapedCommand: 'unknown command',213 stdout: '',214 stderr: '',215 failed: true,216 timedOut: false,217 isCanceled: false,

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 218why, one step back
218 isTerminated: false

3.3.0ehmickybefore adoptionf1eda9c

line 219why, one step back
219 }

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 220–221why, one step back
220 */
221}

3.3.0ehmickybefore adoptionf1eda9c

lines 222–225why, one step back
222```
223224## API225

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 226why, one step back
226### Methods

3.3.0ehmickybefore adoptionf1eda9c

line 227why, one step back
227

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 228why, one step back
228#### execa(file, arguments?, options?)

3.3.0ehmickybefore adoptionf1eda9c

line 229why, one step back
229

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

line 230why, one step back
230Executes a command using `file ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a [`childProcess`](#childprocess).

3.3.0ehmickybefore adoptionf1eda9c

line 231why, one step back
231

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 232why, one step back
232Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.

3.3.0ehmickybefore adoptionf1eda9c

line 233why, one step back
233

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 234why, one step back
234This is the preferred method when executing single commands.

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 235why, one step back
235

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

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

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 237why, one step back
237

Allow the first argument of `execa()` to be a file URL (#631)ehmickybefore adoption3bbd8ae

line 238why, one step back
238Executes a Node.js file using `node scriptPath ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a [`childProcess`](#childprocess).

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 239why, one step back
239

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 240why, one step back
240Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 241why, one step back
241

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 242why, one step back
242This is the preferred method when executing Node.js files.

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 243why, one step back
243

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 244why, one step back
244Like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options):

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 245–246why, one step back
245- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.
246- the [`shell`](#shell) option cannot be used

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 247why, one step back
247- an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio-1)

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 248why, one step back
248

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 249why, one step back
249#### $\`command\`

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 250why, one step back
250

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 251why, one step back
251Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a [`childProcess`](#childprocess).

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 252why, one step back
252

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 253why, one step back
253Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must use `${}` like `` $`echo ${'has space'}` ``.

3.3.0ehmickybefore adoptionf1eda9c

line 254why, one step back
254

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

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

3.3.0ehmickybefore adoptionf1eda9c

line 256why, one step back
256

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 257why, one step back
257The `command` string can inject any `${value}` with the following types: string, number, [`childProcess`](#childprocess) or an array of those types. For example: `` $`echo one ${'two'} ${3} ${['four', 'five']}` ``. For `${childProcess}`, the process's `stdout` is used.

3.3.0ehmickybefore adoptionf1eda9c

line 258why, one step back
258

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 259why, one step back
259For more information, please see [this section](#scripts-interface) and [this page](docs/scripts.md).

3.3.0ehmickybefore adoptionf1eda9c

line 260why, one step back
260

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 261why, one step back
261#### $(options)

3.3.0ehmickybefore adoptionf1eda9c

line 262why, one step back
262

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 263why, one step back
263Returns a new instance of [`$`](#command) but with different default `options`. Consecutive calls are merged to previous ones.

3.3.0ehmickybefore adoptionf1eda9c

line 264why, one step back
264

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 265why, one step back
265This can be used to either:

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 266–267why, one step back
266- Set options for a specific command: `` $(options)`command` ``
267- Share options for multiple commands: `` const $$ = $(options); $$`command`; $$`otherCommand`; ``

3.3.0ehmickybefore adoptionf1eda9c

line 268why, one step back
268

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

line 269why, one step back
269#### execaCommand(command, options?)

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

line 270why, one step back
270

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

lines 271–280why, one step back
271Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a [`childProcess`](#childprocess).
272273Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.274275This is the preferred method when executing a user-supplied `command` string, such as in a REPL.276277### execaSync(file, arguments?, options?)278279Same as [`execa()`](#execacommandcommand-options) but synchronous.280

Allow Node.js streams with synchronous methods (#708)ehmickybefore adoption86bdadf

line 281why, one step back
281Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio-1) and [`input`](#input) options cannot be an array, an iterable or a web stream. Node.js streams [must have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr) unless the `input` option is used.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

line 282why, one step back
282

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

lines 283–285why, one step back
283Returns or throws a [`childProcessResult`](#childProcessResult).
284285### $.sync\`command\`

Add `$.s` as an alias for `$.sync` (#594)ehmickybefore adoptionb719fb0

line 286why, one step back
286### $.s\`command\`

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

lines 287–289why, one step back
287
288Same as [$\`command\`](#command) but synchronous.289

Allow Node.js streams with synchronous methods (#708)ehmickybefore adoption86bdadf

line 290why, one step back
290Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio-1) and [`input`](#input) options cannot be an array, an iterable or a web stream. Node.js streams [must have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr) unless the `input` option is used.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

line 291why, one step back
291

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

lines 292–297why, one step back
292Returns or throws a [`childProcessResult`](#childProcessResult).
293294### execaCommandSync(command, options?)295296Same as [`execaCommand()`](#execacommand-command-options) but synchronous.297

Allow Node.js streams with synchronous methods (#708)ehmickybefore adoption86bdadf

line 298why, one step back
298Cannot use the following options: [`all`](#all-2), [`cleanup`](#cleanup), [`buffer`](#buffer), [`detached`](#detached), [`serialization`](#serialization) and [`signal`](#signal). Also, the [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1), [`stdio`](#stdio-1) and [`input`](#input) options cannot be an array, an iterable or a web stream. Node.js streams [must have a file descriptor](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr) unless the `input` option is used.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

line 299why, one step back
299

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

lines 300–305why, one step back
300Returns or throws a [`childProcessResult`](#childProcessResult).
301302### Shell syntax303304For all the [methods above](#methods), no shell interpreter (Bash, cmd.exe, etc.) is used unless the [`shell` option](#shell) is set. This means shell-specific characters and expressions (`$variable`, `&&`, `||`, `;`, `|`, etc.) have no special meaning and do not need to be escaped.305

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

lines 306–307why, one step back
306### childProcess
307

Improve main method documentation (#545)ehmickybefore adoptiondb2ad9a

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

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 309–310why, one step back
309- a `Promise` resolving or rejecting with a [`childProcessResult`](#childProcessResult).
310- a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess) with the following additional methods and properties.

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

lines 311–315why, one step back
311
312#### all313314Type: `ReadableStream | undefined`315

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

line 316why, one step back
316Stream [combining/interleaving](#ensuring-all-output-is-interleaved) [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

lines 317–318why, one step back
317
318This is `undefined` if either:

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 319–320why, one step back
319- the [`all` option](#all-2) is `false` (the default value)
320- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

lines 321–324why, one step back
321
322#### pipeStdout(target)323324[Pipe](https://nodejs.org/api/stream.html#readablepipedestination-options) the child process's `stdout` to `target`, which can be:

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 325–327why, one step back
325- Another [`execa()` return value](#pipe-multiple-processes)
326- A [writable stream](#save-and-pipe-output-from-a-child-process)327- A [file path string](#redirect-output-to-a-file)

Move the `childProcess` section in the readme.md (#539)ehmickybefore adoption4993dcb

lines 328–343why, one step back
328
329If the `target` is another [`execa()` return value](#execacommandcommand-options), it is returned. Otherwise, the original `execa()` return value is returned. This allows chaining `pipeStdout()` then `await`ing the [final result](#childprocessresult).330331The [`stdout` option](#stdout-1) must be kept as `pipe`, its default value.332333#### pipeStderr(target)334335Like [`pipeStdout()`](#pipestdouttarget) but piping the child process's `stderr` instead.336337The [`stderr` option](#stderr-1) must be kept as `pipe`, its default value.338339#### pipeAll(target)340341Combines both [`pipeStdout()`](#pipestdouttarget) and [`pipeStderr()`](#pipestderrtarget).342343Either the [`stdout` option](#stdout-1) or the [`stderr` option](#stderr-1) must be kept as `pipe`, their default value. Also, the [`all` option](#all-2) must be set to `true`.

3.3.0ehmickybefore adoptionf1eda9c

lines 344–352why, one step back
344
345### childProcessResult346347Type: `object`348349Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.350351The child process [fails](#failed) when:352- its [exit code](#exitcode) is not `0`

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 353why, one step back
353- it was [terminated](#isterminated) with a [signal](#signal)

3.3.0ehmickybefore adoptionf1eda9c

lines 354–361why, one step back
354- [timing out](#timedout)
355- [being canceled](#iscanceled)356- there's not enough memory or there are already too many child processes357358#### command359360Type: `string`361

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

lines 362–363why, one step back
362The file and arguments that were run, for logging purposes.
363

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 364why, one step back
364This is not escaped and should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

lines 365–369why, one step back
365
366#### escapedCommand367368Type: `string`369

Fix anchor in readme.md (#530)ehmickybefore adoption2c58762

line 370why, one step back
370Same as [`command`](#command-1) but escaped.

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

lines 371–372why, one step back
371
372This is meant to be copy and pasted into a shell, for debugging purposes.

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 373why, one step back
373Since the escaping is fairly basic, this should not be executed directly as a process, including using [`execa()`](#execafile-arguments-options) or [`execaCommand()`](#execacommandcommand-options).

3.3.0ehmickybefore adoptionf1eda9c

lines 374–376why, one step back
374
375#### exitCode376

Document and type `exitCode` being `undefined` (#680)ehmickybefore adoption95e5754

line 377why, one step back
377Type: `number | undefined`

3.3.0ehmickybefore adoptionf1eda9c

lines 378–379why, one step back
378
379The numeric exit code of the process that was run.

Document and type `exitCode` being `undefined` (#680)ehmickybefore adoption95e5754

lines 380–381why, one step back
380
381This is `undefined` when the process could not be spawned or was terminated by a [signal](#signal-1).

3.3.0ehmickybefore adoptionf1eda9c

lines 382–384why, one step back
382
383#### stdout384

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 385why, one step back
385Type: `string | Uint8Array | unknown[] | undefined`

3.3.0ehmickybefore adoptionf1eda9c

line 386why, one step back
386

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 387why, one step back
387The output of the process on `stdout`.

3.3.0ehmickybefore adoptionf1eda9c

line 388why, one step back
388

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 389why, one step back
389This is `undefined` if the [`stdout`](#stdout-1) option is set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the `stdout` option is a [transform in object mode](docs/transform.md#object-mode).

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 390why, one step back
390

3.3.0ehmickybefore adoptionf1eda9c

lines 391–392why, one step back
391#### stderr
392

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 393why, one step back
393Type: `string | Uint8Array | unknown[] | undefined`

3.3.0ehmickybefore adoptionf1eda9c

line 394why, one step back
394

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 395why, one step back
395The output of the process on `stderr`.

3.3.0ehmickybefore adoptionf1eda9c

line 396why, one step back
396

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 397why, one step back
397This is `undefined` if the [`stderr`](#stderr-1) option is set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). This is an array if the `stderr` option is a [transform in object mode](docs/transform.md#object-mode).

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 398why, one step back
398

3.3.0ehmickybefore adoptionf1eda9c

lines 399–400why, one step back
399#### all
400

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 401why, one step back
401Type: `string | Uint8Array | unknown[] | undefined`

3.3.0ehmickybefore adoptionf1eda9c

line 402why, one step back
402

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

line 403why, one step back
403The output of the process with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).

3.3.0ehmickybefore adoptionf1eda9c

lines 404–405why, one step back
404
405This is `undefined` if either:

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 406–407why, one step back
406- the [`all` option](#all-2) is `false` (the default value)
407- both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)

3.3.0ehmickybefore adoptionf1eda9c

line 408why, one step back
408

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 409–410why, one step back
409This is an array if either the `stdout` or `stderr` option is a [transform in object mode](docs/transform.md#object-mode).
410

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 411–412why, one step back
411#### stdio
412

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 413why, one step back
413Type: `Array<string | Uint8Array | unknown[] | undefined>`

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 414–416why, one step back
414
415The output of the process on [`stdin`](#stdin), [`stdout`](#stdout-1), [`stderr`](#stderr-1) and [other file descriptors](#stdio-1).416

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 417why, one step back
417Items are `undefined` when their corresponding [`stdio`](#stdio-1) option is set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio). Items are arrays when their corresponding `stdio` option is a [transform in object mode](docs/transform.md#object-mode).

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 418why, one step back
418

3.3.0ehmickybefore adoptionf1eda9c

lines 419–434why, one step back
419#### failed
420421Type: `boolean`422423Whether the process failed to run.424425#### timedOut426427Type: `boolean`428429Whether the process timed out.430431#### isCanceled432433Type: `boolean`434

Remove `.cancel()` method (#711)ehmickybefore adoption16e5fd6

line 435why, one step back
435Whether the process was canceled using the [`signal`](#signal-1) option.

Support `AbortController` (#490)Gyubongbefore adoptionc6e791a

line 436why, one step back
436

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 437why, one step back
437#### isTerminated

3.3.0ehmickybefore adoptionf1eda9c

lines 438–440why, one step back
438
439Type: `boolean`440

Improve process termination (#724)ehmickybefore adoption1c48d37

lines 441–443why, one step back
441Whether the process was terminated by a signal (like `SIGTERM`) sent by either:
442- The current process.443- Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).

3.3.0ehmickybefore adoptionf1eda9c

lines 444–448why, one step back
444
445#### signal446447Type: `string | undefined`448

Improve process termination (#724)ehmickybefore adoption1c48d37

lines 449–451why, one step back
449The name of the signal (like `SIGTERM`) that terminated the process, sent by either:
450- The current process.451- Another process. This case is [not supported on Windows](https://nodejs.org/api/process.html#signal-events).

3.3.0ehmickybefore adoptionf1eda9c

lines 452–462why, one step back
452
453If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.454455#### signalDescription456457Type: `string | undefined`458459A human-friendly description of the signal that was used to terminate the process. For example, `Floating point arithmetic error`.460461If a signal terminated the process, 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.462

Add `cwd` error property (#565)homersimpsonsbefore adoptionf57fdec

lines 463–468why, one step back
463#### cwd
464465Type: `string`466467The `cwd` of the command if provided in the [command options](#cwd-1). Otherwise it is `process.cwd()`.468

Add stdout/stderr to error messages (#397)ehmickybefore adoptionbc520f9

lines 469–474why, one step back
469#### message
470471Type: `string`472473Error message when the child process failed to run. In addition to the [underlying error message](#originalMessage), it also contains some information related to why the child process errored.474

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 475why, one step back
475The child process [`stderr`](#stderr), [`stdout`](#stdout) and other [file descriptors' output](#stdio) are appended to the end, separated with newlines and not interleaved.

Add stdout/stderr to error messages (#397)ehmickybefore adoptionbc520f9

lines 476–480why, one step back
476
477#### shortMessage478479Type: `string`480

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 481why, one step back
481This is the same as the [`message` property](#message) except it does not include the child process [`stdout`](#stdout)/[`stderr`](#stderr)/[`stdio`](#stdio).

Add stdout/stderr to error messages (#397)ehmickybefore adoptionbc520f9

line 482why, one step back
482

3.3.0ehmickybefore adoptionf1eda9c

lines 483–486why, one step back
483#### originalMessage
484485Type: `string | undefined`486

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 487why, one step back
487Original error message. This is the same as the `message` property excluding the child process [`stdout`](#stdout)/[`stderr`](#stderr)/[`stdio`](#stdio) and some additional information added by Execa.

3.3.0ehmickybefore adoptionf1eda9c

line 488why, one step back
488

Add stdout/stderr to error messages (#397)ehmickybefore adoptionbc520f9

line 489why, one step back
489This is `undefined` unless the child process exited due to an `error` event or a timeout.

3.3.0ehmickybefore adoptionf1eda9c

lines 490–496why, one step back
490
491### options492493Type: `object`494495#### cleanup496

Meta tweaksSindre Sorhusbefore adoption4093556

line 497why, one step back
497Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 498–505why, one step back
498Default: `true`
499500Kill the spawned process when the parent process exits unless either:501 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)502 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit503504#### preferLocal505

Meta tweaksSindre Sorhusbefore adoption4093556

line 506why, one step back
506Type: `boolean`\

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 507why, one step back
507Default: `true` with [`$`](#command), `false` otherwise

3.3.0ehmickybefore adoptionf1eda9c

line 508why, one step back
508

Meta tweaksSindre Sorhusbefore adoption4093556

line 509why, one step back
509Prefer locally installed binaries when looking for a binary to execute.\

3.3.0ehmickybefore adoptionf1eda9c

lines 510–513why, one step back
510If you `$ npm install foo`, you can then `execa('foo')`.
511512#### localDir513

Allow `cwd` and `localDir` options to be URLs (#492)ehmickybefore adoption93ab929

line 514why, one step back
514Type: `string | URL`\

3.3.0ehmickybefore adoptionf1eda9c

lines 515–520why, one step back
515Default: `process.cwd()`
516517Preferred path to find locally installed binaries in (use with `preferLocal`).518519#### execPath520

Allow the `execPath` option to be a file URL (#633)ehmickybefore adoptionb495146

line 521why, one step back
521Type: `string | URL`\

Meta tweaksSindre Sorhusbefore adoption4093556

line 522why, one step back
522Default: `process.execPath` (Current Node.js executable)

3.3.0ehmickybefore adoptionf1eda9c

lines 523–533why, one step back
523
524Path to the Node.js executable to use in child processes.525526This can be either an absolute path or a path relative to the [`cwd` option](#cwd).527528Requires [`preferLocal`](#preferlocal) to be `true`.529530For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.531532#### buffer533

Meta tweaksSindre Sorhusbefore adoption4093556

line 534why, one step back
534Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 535–538why, one step back
535Default: `true`
536537Buffer the output from the spawned process. When set to `false`, you must read the output of [`stdout`](#stdout-1) and [`stderr`](#stderr-1) (or [`all`](#all) if the [`all`](#all-2) option is `true`). Otherwise the returned promise will not be resolved/rejected.538

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 539why, one step back
539If the spawned process fails, [`error.stdout`](#stdout), [`error.stderr`](#stderr), [`error.all`](#all) and [`error.stdio`](#stdio) will contain the buffered data.

3.3.0ehmickybefore adoptionf1eda9c

lines 540–542why, one step back
540
541#### input542

Require Node.js 18Sindre Sorhusbefore adoption834e372

line 543why, one step back
543Type: `string | Uint8Array | stream.Readable`

3.3.0ehmickybefore adoptionf1eda9c

line 544why, one step back
544

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

line 545why, one step back
545Write some input to the child process' `stdin`.

Add `inputFile` option (#542)ehmickybefore adoption0726126

line 546why, one step back
546

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 547why, one step back
547See also the [`inputFile`](#inputfile) and [`stdin`](#stdin) options.

Add `inputFile` option (#542)ehmickybefore adoption0726126

lines 548–550why, one step back
548
549#### inputFile550

Add support for file URLs with the `inputFile` option (#630)ehmickybefore adoptionbe739e7

line 551why, one step back
551Type: `string | URL`

Add `inputFile` option (#542)ehmickybefore adoption0726126

line 552why, one step back
552

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 553why, one step back
553Use a file as input to the child process' `stdin`.

Add `inputFile` option (#542)ehmickybefore adoption0726126

line 554why, one step back
554

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 555why, one step back
555See also the [`input`](#input) and [`stdin`](#stdin) options.

3.3.0ehmickybefore adoptionf1eda9c

lines 556–558why, one step back
556
557#### stdin558

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

line 559why, one step back
559Type: `string | number | stream.Readable | ReadableStream | URL | Uint8Array | Iterable<string | Uint8Array> | AsyncIterable<string | Uint8Array> | AsyncGeneratorFunction<string | Uint8Array>` (or a tuple of those types)\

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 560why, one step back
560Default: `inherit` with [`$`](#command), `pipe` otherwise

3.3.0ehmickybefore adoptionf1eda9c

line 561why, one step back
561

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 562–568why, one step back
562[How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard input. This can be:
563- `'pipe'`: Sets [`childProcess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin) stream.564- `'overlapped'`: Like `'pipe'` but asynchronous on Windows.565- `'ignore'`: Do not use `stdin`.566- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.567- `'inherit'`: Re-use the current process' `stdin`.568- an integer: Re-use a specific file descriptor from the current process.

Document how to pass a Node.js stream to stdin/stdout/stderr (#644)ehmickybefore adoption2500696

line 569why, one step back
569- a [Node.js `Readable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).

Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13

line 570why, one step back
570- `{ file: 'path' }` object.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

lines 571–573why, one step back
571- a file URL.
572- a web [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).573- an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol) or an [`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)

Allow `stdin: uint8Array` option (#670)ehmickybefore adoption2ac81d4

line 574why, one step back
574- an `Uint8Array`.

Allow `stdin` to be a sync/async iterable (#604)ehmickybefore adoptionec380db

line 575why, one step back
575

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 576–577why, one step back
576This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.
577

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

lines 578–579why, one step back
578This can also be an async generator function to transform the input. [Learn more.](docs/transform.md)
579

3.3.0ehmickybefore adoptionf1eda9c

lines 580–581why, one step back
580#### stdout
581

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

line 582why, one step back
582Type: `string | number | stream.Writable | WritableStream | URL | AsyncGeneratorFunction<string | Uint8Array>` (or a tuple of those types)\

3.3.0ehmickybefore adoptionf1eda9c

lines 583–584why, one step back
583Default: `pipe`
584

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 585why, one step back
585[How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard output. This can be:

Improve documentation of `pipe` option (#637)ehmickybefore adoption9632b38

line 586why, one step back
586- `'pipe'`: Sets [`childProcessResult.stdout`](#stdout) (as a string or `Uint8Array`) and [`childProcess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 587–591why, one step back
587- `'overlapped'`: Like `'pipe'` but asynchronous on Windows.
588- `'ignore'`: Do not use `stdout`.589- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.590- `'inherit'`: Re-use the current process' `stdout`.591- an integer: Re-use a specific file descriptor from the current process.

Document how to pass a Node.js stream to stdin/stdout/stderr (#644)ehmickybefore adoption2500696

line 592why, one step back
592- a [Node.js `Writable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).

Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13

line 593why, one step back
593- `{ file: 'path' }` object.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

lines 594–595why, one step back
594- a file URL.
595- a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).

3.3.0ehmickybefore adoptionf1eda9c

line 596why, one step back
596

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 597–598why, one step back
597This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.
598

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

lines 599–600why, one step back
599This can also be an async generator function to transform the output. [Learn more.](docs/transform.md)
600

3.3.0ehmickybefore adoptionf1eda9c

lines 601–602why, one step back
601#### stderr
602

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

line 603why, one step back
603Type: `string | number | stream.Writable | WritableStream | URL | AsyncGeneratorFunction<string | Uint8Array>` (or a tuple of those types)`\

3.3.0ehmickybefore adoptionf1eda9c

lines 604–605why, one step back
604Default: `pipe`
605

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 606why, one step back
606[How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard error. This can be:

Improve documentation of `pipe` option (#637)ehmickybefore adoption9632b38

line 607why, one step back
607- `'pipe'`: Sets [`childProcessResult.stderr`](#stderr) (as a string or `Uint8Array`) and [`childProcess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 608–612why, one step back
608- `'overlapped'`: Like `'pipe'` but asynchronous on Windows.
609- `'ignore'`: Do not use `stderr`.610- `'ipc'`: Sets an [IPC channel](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback). You can also use [`execaNode()`](#execanodescriptpath-arguments-options) instead.611- `'inherit'`: Re-use the current process' `stderr`.612- an integer: Re-use a specific file descriptor from the current process.

Document how to pass a Node.js stream to stdin/stdout/stderr (#644)ehmickybefore adoption2500696

line 613why, one step back
613- a [Node.js `Writable` stream](#redirect-a-nodejs-stream-fromto-stdinstdoutstderr).

Improve syntax of `std*: filePath` option (#671)ehmickybefore adoption90e0e13

line 614why, one step back
614- `{ file: 'path' }` object.

Improve documentation of synchronous methods (#669)ehmickybefore adoptionb11cbcd

lines 615–616why, one step back
615- a file URL.
616- a web [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream).

3.3.0ehmickybefore adoptionf1eda9c

line 617why, one step back
617

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 618–619why, one step back
618This can be an [array of values](#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.
619

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

lines 620–621why, one step back
620This can also be an async generator function to transform the output. [Learn more.](docs/transform.md)
621

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 622–623why, one step back
622#### stdio
623

Allow passing generators to the `std*` options (#693)ehmickybefore adoptione8f6bbd

line 624why, one step back
624Type: `string | Array<string | number | stream.Readable | stream.Writable | ReadableStream | WritableStream | URL | Uint8Array | Iterable<string | Uint8Array> | AsyncIterable<string | Uint8Array> | AsyncGeneratorFunction<string | Uint8Array>>` (or a tuple of those types)\

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

lines 625–626why, one step back
625Default: `pipe`
626

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

line 627why, one step back
627Like the [`stdin`](#stdin), [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options but for all file descriptors at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.

Improve documentation of `stdin`, `stdout`, `stderr` and `stdio` (#626)ehmickybefore adoptionc405105

line 628why, one step back
628

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 629–632why, one step back
629A single string can be used as a shortcut. For example, `{stdio: 'pipe'}` is the same as `{stdin: 'pipe', stdout: 'pipe', stderr: 'pipe'}`.
630631The array can have more than 3 items, to create additional file descriptors beyond `stdin`/`stdout`/`stderr`. For example, `{stdio: ['pipe', 'pipe', 'pipe', 'ipc']}` sets a fourth file descriptor `'ipc'`.632

3.3.0ehmickybefore adoptionf1eda9c

lines 633–634why, one step back
633#### all
634

Meta tweaksSindre Sorhusbefore adoption4093556

line 635why, one step back
635Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 636–637why, one step back
636Default: `false`
637

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

line 638why, one step back
638Add an `.all` property on the [promise](#all) and the [resolved value](#all-1). The property contains the output of the process with `stdout` and `stderr` [interleaved](#ensuring-all-output-is-interleaved).

3.3.0ehmickybefore adoptionf1eda9c

lines 639–641why, one step back
639
640#### reject641

Meta tweaksSindre Sorhusbefore adoption4093556

line 642why, one step back
642Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 643–648why, one step back
643Default: `true`
644645Setting this to `false` resolves the promise with the error instead of rejecting it.646647#### stripFinalNewline648

Meta tweaksSindre Sorhusbefore adoption4093556

line 649why, one step back
649Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 650–655why, one step back
650Default: `true`
651652Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.653654#### extendEnv655

Meta tweaksSindre Sorhusbefore adoption4093556

line 656why, one step back
656Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 657–658why, one step back
657Default: `true`
658

Improve documentation of the `extendEnv` and `env` options (#710)ehmickybefore adoption163d6ee

lines 659–660why, one step back
659If `true`, the child process uses both the [`env` option](#env) and the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).
660If `false`, only the `env` option is used, not `process.env`.

3.3.0ehmickybefore adoptionf1eda9c

lines 661–667why, one step back
661
662---663664Execa also accepts the below options which are the same as the options for [`child_process#spawn()`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)/[`child_process#exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)665666#### cwd667

Allow `cwd` and `localDir` options to be URLs (#492)ehmickybefore adoption93ab929

line 668why, one step back
668Type: `string | URL`\

3.3.0ehmickybefore adoptionf1eda9c

lines 669–671why, one step back
669Default: `process.cwd()`
670671Current working directory of the child process.

Allow `cwd` and `localDir` options to be URLs (#492)ehmickybefore adoption93ab929

line 672why, one step back
672

3.3.0ehmickybefore adoptionf1eda9c

lines 673–674why, one step back
673#### env
674

Meta tweaksSindre Sorhusbefore adoption4093556

line 675why, one step back
675Type: `object`\

3.3.0ehmickybefore adoptionf1eda9c

lines 676–677why, one step back
676Default: `process.env`
677

Improve documentation of the `extendEnv` and `env` options (#710)ehmickybefore adoption163d6ee

lines 678–680why, one step back
678Environment key-value pairs.
679680Unless the [`extendEnv` option](#extendenv) is `false`, the child process also uses the current process' environment variables ([`process.env`](https://nodejs.org/api/process.html#processenv)).

3.3.0ehmickybefore adoptionf1eda9c

lines 681–687why, one step back
681
682#### argv0683684Type: `string`685686Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.687

Add `serialization` option (#392)ehmickybefore adoption31ac967

lines 688–689why, one step back
688#### serialization
689

Meta tweaksSindre Sorhusbefore adoption4093556

line 690why, one step back
690Type: `string`\

Add `serialization` option (#392)ehmickybefore adoption31ac967

lines 691–692why, one step back
691Default: `'json'`
692

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 693why, one step back
693Specify the kind of serialization used for sending messages between processes when using the [`stdio: 'ipc'`](#stdio-1) option or [`execaNode()`](#execanodescriptpath-arguments-options):

Add `serialization` option (#392)ehmickybefore adoption31ac967

lines 694–698why, one step back
694 - `json`: Uses `JSON.stringify()` and `JSON.parse()`.
695 - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)696697[More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)698

3.3.0ehmickybefore adoptionf1eda9c

lines 699–718why, one step back
699#### detached
700701Type: `boolean`702703Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).704705#### uid706707Type: `number`708709Sets the user identity of the process.710711#### gid712713Type: `number`714715Sets the group identity of the process.716717#### shell718

Allow `shell` option to be a file URL (#635)ehmickybefore adoption189d486

line 719why, one step back
719Type: `boolean | string | URL`\

3.3.0ehmickybefore adoptionf1eda9c

lines 720–730why, one step back
720Default: `false`
721722If `true`, runs `file` inside of a shell. Uses `/bin/sh` on UNIX and `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.723724We recommend against using this option since it is:725- not cross-platform, encouraging shell-specific syntax.726- slower, because of the additional shell interpretation.727- unsafe, potentially allowing command injection.728729#### encoding730

Make `buffer` encoding option return `Uint8Array` instead of `Buffer` (#586)Youngbefore adoption1afeb81

line 731why, one step back
731Type: `string`\

3.3.0ehmickybefore adoptionf1eda9c

lines 732–733why, one step back
732Default: `utf8`
733

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 734why, one step back
734Specify the character encoding used to decode the [`stdout`](#stdout), [`stderr`](#stderr) and [`stdio`](#stdio) output. If set to `'buffer'`, then `stdout`, `stderr` and `stdio` will be `Uint8Array`s instead of strings.

3.3.0ehmickybefore adoptionf1eda9c

lines 735–737why, one step back
735
736#### timeout737

Meta tweaksSindre Sorhusbefore adoption4093556

line 738why, one step back
738Type: `number`\

3.3.0ehmickybefore adoptionf1eda9c

lines 739–740why, one step back
739Default: `0`
740

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

line 741why, one step back
741If `timeout`` is greater than `0`, the child process will be [terminated](#killsignal) if it runs for longer than that amount of milliseconds.

3.3.0ehmickybefore adoptionf1eda9c

lines 742–744why, one step back
742
743#### maxBuffer744

Meta tweaksSindre Sorhusbefore adoption4093556

line 745why, one step back
745Type: `number`\

3.3.0ehmickybefore adoptionf1eda9c

lines 746–747why, one step back
746Default: `100_000_000` (100 MB)
747

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

line 748why, one step back
748Largest amount of data in bytes allowed on [`stdout`](#stdout), [`stderr`](#stderr) and [`stdio`](#stdio).

3.3.0ehmickybefore adoptionf1eda9c

lines 749–751why, one step back
749
750#### killSignal751

Meta tweaksSindre Sorhusbefore adoption4093556

line 752why, one step back
752Type: `string | number`\

3.3.0ehmickybefore adoptionf1eda9c

lines 753–754why, one step back
753Default: `SIGTERM`
754

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

lines 755–759why, one step back
755Signal used to terminate the child process when:
756- using the [`signal`](#signal-1), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option757- calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments758759This can be either a name (like `"SIGTERM"`) or a number (like `9`).

Support `AbortController` (#490)Gyubongbefore adoptionc6e791a

line 760why, one step back
760

Rename `forceKillAfterTimeout` to `forceKillAfterDelay` (#723)ehmickybefore adoption0ff8b34

line 761why, one step back
761#### forceKillAfterDelay

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

lines 762–780why, one step back
762
763Type: `number | false`\764Default: `5000`765766If the child process is terminated but does not exit, forcefully exit it by sending [`SIGKILL`](https://en.wikipedia.org/wiki/Signal_(IPC)#SIGKILL).767768The grace period is 5 seconds by default. This feature can be disabled with `false`.769770This works when the child process is terminated by either:771- the [`signal`](#signal-1), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option772- calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments773774This does not work when the child process is terminated by either:775- calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with an argument776- calling [`process.kill(subprocess.pid)`](https://nodejs.org/api/process.html#processkillpid-signal)777- sending a termination signal from another process778779Also, this does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events): `SIGKILL` and `SIGTERM` both terminate the process immediately. Other packages (such as [`taskkill`](https://github.com/sindresorhus/taskkill)) can be used to achieve fail-safe termination on Windows.780

Support `AbortController` (#490)Gyubongbefore adoptionc6e791a

lines 781–786why, one step back
781#### signal
782783Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)784785You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).786

Fix documentation typo (#568)Gray Zhangbefore adoptionf31fbdb

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

Support `AbortController` (#490)Gyubongbefore adoptionc6e791a

line 788why, one step back
788

3.3.0ehmickybefore adoptionf1eda9c

lines 789–790why, one step back
789#### windowsVerbatimArguments
790

Meta tweaksSindre Sorhusbefore adoption4093556

line 791why, one step back
791Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 792–797why, one step back
792Default: `false`
793794If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.795796#### windowsHide797

Meta tweaksSindre Sorhusbefore adoption4093556

line 798why, one step back
798Type: `boolean`\

3.3.0ehmickybefore adoptionf1eda9c

lines 799–801why, one step back
799Default: `true`
800801On Windows, do not create a new console window. Please note this also prevents `CTRL-C` [from working](https://github.com/nodejs/node/issues/29837) on Windows.

Add `verbose` option (#532)ehmickybefore adoption69ce814

lines 802–810why, one step back
802
803#### verbose804805Type: `boolean`\806Default: `false`807808[Print each command](#verbose-mode) on `stderr` before executing it.809810This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.

3.3.0ehmickybefore adoptionf1eda9c

line 811why, one step back
811

Meta tweaksSindre Sorhusbefore adoption4093556

line 812why, one step back
812#### nodePath *(For `.node()` only)*

3.3.0ehmickybefore adoptionf1eda9c

line 813why, one step back
813

Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477

line 814why, one step back
814Type: `string | URL`\

3.3.0ehmickybefore adoptionf1eda9c

lines 815–818why, one step back
815Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)
816817Node.js executable used to create the child process.818

Meta tweaksSindre Sorhusbefore adoption4093556

line 819why, one step back
819#### nodeOptions *(For `.node()` only)*

3.3.0ehmickybefore adoptionf1eda9c

line 820why, one step back
820

Meta tweaksSindre Sorhusbefore adoption4093556

line 821why, one step back
821Type: `string[]`\

3.3.0ehmickybefore adoptionf1eda9c

lines 822–826why, one step back
822Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)
823824List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.825826## Tips

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 827–833why, one step back
827
828### Redirect stdin/stdout/stderr to multiple destinations829830The [`stdin`](#stdin), [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options can be an array of values.831The following example redirects `stdout` to both the terminal and an `output.txt` file, while also retrieving its value programmatically.832833```js

Allow Node.js streams with synchronous methods (#708)ehmickybefore adoption86bdadf

line 834why, one step back
834const {stdout} = await execa('npm', ['install'], {stdout: ['inherit', './output.txt', 'pipe']});

Allow `stdin`/`stdout`/`stderr` to be an array (#643)ehmickybefore adoption7efd50c

lines 835–838why, one step back
835console.log(stdout);
836```837838When combining `inherit` with other values, please note that the child process will not be an interactive TTY, even if the parent process is one.

Document how to pass a Node.js stream to stdin/stdout/stderr (#644)ehmickybefore adoption2500696

lines 839–852why, one step back
839
840### Redirect a Node.js stream from/to stdin/stdout/stderr841842When passing a Node.js stream to the [`stdin`](#stdin), [`stdout`](#stdout-1) or [`stderr`](#stderr-1) option, Node.js requires that stream to have an underlying file or socket, such as the streams created by the `fs`, `net` or `http` core modules. Otherwise the following error is thrown.843844```845TypeError [ERR_INVALID_ARG_VALUE]: The argument 'stdio' is invalid.846```847848This limitation can be worked around by passing either:849 - a web stream ([`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) or [`WritableStream`](https://developer.mozilla.org/en-US/docs/Web/API/WritableStream))850 - `[nodeStream, 'pipe']` instead of `nodeStream`851852```diff

Allow Node.js streams with synchronous methods (#708)ehmickybefore adoption86bdadf

lines 853–854why, one step back
853- await execa(..., {stdout: nodeStream});
854+ await execa(..., {stdout: [nodeStream, 'pipe']});

Document how to pass a Node.js stream to stdin/stdout/stderr (#644)ehmickybefore adoption2500696

line 855why, one step back
855```

3.3.0ehmickybefore adoptionf1eda9c

lines 856–858why, one step back
856
857### Retry on error858

Improve graceful exit (#714)ehmickybefore adoption5eeaab5

line 859why, one step back
859Safely handle failures by using automatic retries and exponential backoff with the [`p-retry`](https://github.com/sindresorhus/p-retry) package:

3.3.0ehmickybefore adoptionf1eda9c

lines 860–861why, one step back
860
861```js

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 862why, one step back
862import pRetry from 'p-retry';

3.3.0ehmickybefore adoptionf1eda9c

lines 863–868why, one step back
863
864const run = async () => {865 const results = await execa('curl', ['-sSL', 'https://sindresorhus.com/unicorn']);866 return results;867};868

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 869why, one step back
869console.log(await pRetry(run, {retries: 5}));

3.3.0ehmickybefore adoptionf1eda9c

lines 870–871why, one step back
870```
871

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 872–886why, one step back
872### Cancelling a spawned process
873874```js875import {execa} from 'execa';876877const abortController = new AbortController();878const subprocess = execa('node', [], {signal: abortController.signal});879880setTimeout(() => {881 abortController.abort();882}, 1000);883884try {885 await subprocess;886} catch (error) {

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 887why, one step back
887 console.log(error.isTerminated); // true

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 888–891why, one step back
888 console.log(error.isCanceled); // true
889}890```891

3.3.0ehmickybefore adoptionf1eda9c

lines 892–893why, one step back
892### Execute the current package's binary
893

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

lines 894–895why, one step back
894Execa can be combined with [`get-bin-path`](https://github.com/ehmicky/get-bin-path) to test the current package's binary. As opposed to hard-coding the path to the binary, this validates that the `package.json` `bin` field is correctly set up.
895

3.3.0ehmickybefore adoptionf1eda9c

line 896why, one step back
896```js

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

line 897why, one step back
897import {getBinPath} from 'get-bin-path';

3.3.0ehmickybefore adoptionf1eda9c

line 898why, one step back
898

Improve documentation of the usage section (#541)ehmickybefore adoption5320fef

lines 899–900why, one step back
899const binPath = await getBinPath();
900await execa(binPath);

3.3.0ehmickybefore adoptionf1eda9c

lines 901–902why, one step back
901```
902

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

line 903why, one step back
903### Ensuring `all` output is interleaved

3.3.0ehmickybefore adoptionf1eda9c

line 904why, one step back
904

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

lines 905–935why, one step back
905The `all` [stream](#all) and [string/`Uint8Array`](#all-1) properties are guaranteed to interleave [`stdout`](#stdout) and [`stderr`](#stderr).
906907However, for performance reasons, the child process might buffer and merge multiple simultaneous writes to `stdout` or `stderr`. This prevents proper interleaving.908909For example, this prints `1 3 2` instead of `1 2 3` because both `console.log()` are merged into a single write.910911```js912import {execa} from 'execa';913914const {all} = await execa('node', ['example.js'], {all: true});915console.log(all);916```917918```js919// example.js920console.log('1'); // writes to stdout921console.error('2'); // writes to stderr922console.log('3'); // writes to stdout923```924925This can be worked around by using `setTimeout()`.926927```js928import {setTimeout} from 'timers/promises';929930console.log('1');931console.error('2');932await setTimeout(0);933console.log('3');934```935

3.3.0ehmickybefore adoptionf1eda9c

lines 936–937why, one step back
936## Related
937

Document workaround for proper `all` interleaving (#640)ehmickybefore adoption21d69c0

lines 938–939why, one step back
938- [gulp-execa](https://github.com/ehmicky/gulp-execa) - Gulp plugin for Execa
939- [nvexeca](https://github.com/ehmicky/nvexeca) - Run Execa using any Node.js version

3.3.0ehmickybefore adoptionf1eda9c

lines 940–944why, one step back
940
941## Maintainers942943- [Sindre Sorhus](https://github.com/sindresorhus)944- [@ehmicky](https://github.com/ehmicky)