Skip to content
Myr

bash.md

This file

Path

docs/bash.md

868 lines · 14.6 KiB · Markdown

Last changed by

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

History of this file

Take it

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 1–84why, one step back
1<picture>
2 <source media="(prefers-color-scheme: dark)" srcset="../media/logo_dark.svg">3 <img alt="execa logo" src="../media/logo.svg" width="400">4</picture>5<br>67# 🔍 Differences with Bash and zx89This page describes the differences between [Bash](https://en.wikipedia.org/wiki/Bash_(Unix_shell)), Execa, and [zx](https://github.com/google/zx) (which inspired this feature). Execa intends to be more:10- [Performant](#performance)11- [Cross-platform](#shell): [no shell](shell.md) is used, only JavaScript.12- [Secure](#escaping): no shell injection.13- [Simple](#simplicity): minimalistic API, no [globals](#global-variables), no [binary](#main-binary), no [builtin CLI utilities](#builtin-utilities).14- [Featureful](#simplicity): all Execa features are available ([text lines iteration](#iterate-over-output-lines), [subprocess piping](#piping-stdout-to-another-command), [IPC](#ipc), [transforms](#transforms), [background subprocesses](#background-subprocess), [cancelation](#cancelation), [local binaries](#local-binaries), [cleanup on exit](termination.md#current-process-exit), [interleaved output](#interleaved-output), [forceful termination](termination.md#forceful-termination), and [more](../readme.md#documentation)).15- [Easy to debug](#debugging): [verbose mode](#verbose-mode), [detailed errors](#errors), [messages and stack traces](#cancelation), stateless API.1617## Flexibility1819Unlike shell languages like Bash, libraries like Execa and zx enable you to write scripts with a more featureful programming language (JavaScript). This allows complex logic (such as [parallel execution](#parallel-commands)) to be expressed easily. This also lets you use [any Node.js package](#builtin-utilities).2021## Shell2223The main difference between Execa and zx is that Execa does not require any shell. Shell-specific keywords and features are [written in JavaScript](#variable-substitution) instead.2425This is more cross-platform. For example, your code works the same on Windows machines without Bash installed.2627Also, there is no shell syntax to remember: everything is just plain JavaScript.2829If you really need a shell though, the [`shell`](shell.md) option can be used.3031## Simplicity3233Execa's scripting API mostly consists of only two methods: [`` $`command` ``](shell.md) and [`$(options)`](execution.md#globalshared-options).3435[No special binary](#main-binary) is recommended, no [global variable](#global-variables) is injected: scripts are regular Node.js files.3637Execa is a thin wrapper around the core Node.js [`child_process` module](https://nodejs.org/api/child_process.html). Unlike zx, it lets you use [any of its native features](#background-subprocess): [`pid`](#pid), [IPC](ipc.md), [`unref()`](https://nodejs.org/api/child_process.html#subprocessunref), [`detached`](environment.md#background-subprocess), [`uid`](windows.md#uid-and-gid), [`gid`](windows.md#uid-and-gid), [`cancelSignal`](termination.md#canceling), etc.3839## Modularity4041zx includes many builtin utilities: `fetch()`, `question()`, `sleep()`, `stdin()`, `retry()`, `spinner()`, `chalk`, `fs-extra`, `os`, `path`, `globby`, `yaml`, `minimist`, `which`, Markdown scripts, remote scripts.4243Execa does not include [any utility](#builtin-utilities): it focuses on being small and modular instead. Any Node.js package can be used in your scripts.4445## Performance4647Spawning a shell for every command comes at a performance cost, which Execa avoids.4849Also, [local binaries](#local-binaries) can be directly executed without using `npx`.5051## Debugging5253Subprocesses can be hard to debug, which is why Execa includes a [`verbose`](#verbose-mode) option.5455Also, Execa's error messages and [properties](#errors) are very detailed to make it clear to determine why a subprocess failed. Error messages and stack traces can be set with [`subprocess.kill(error)`](termination.md#error-message-and-stack-trace).5657Finally, unlike Bash and zx, which are stateful (options, current directory, etc.), Execa is [purely functional](#current-directory), which also helps with debugging.5859## Examples6061### Main binary6263```sh64# Bash65bash file.sh66```6768```js69// zx70zx file.js7172// or a shebang can be used:73// #!/usr/bin/env zx74```7576```js77// Execa scripts are just regular Node.js files78node file.js79```8081### Global variables8283```js84// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 85why, one step back
85await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 86–91why, one step back
86```
8788```js89// Execa90import {$} from 'execa';91

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 92why, one step back
92await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 93–100why, one step back
93```
9495[More info.](execution.md)9697### Command execution9899```sh100# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 101why, one step back
101npm run build

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 102–105why, one step back
102```
103104```js105// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 106why, one step back
106await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 107–110why, one step back
107```
108109```js110// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 111why, one step back
111await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 112–222why, one step back
112```
113114### Multiline commands115116```sh117# Bash118npm run build \119 --example-flag-one \120 --example-flag-two121```122123```js124// zx125await $`npm run build ${[126 '--example-flag-one',127 '--example-flag-two',128]}`;129```130131```js132// Execa133await $`npm run build134 --example-flag-one135 --example-flag-two`;136```137138[More info.](execution.md#multiple-lines)139140### Concatenation141142```sh143# Bash144tmpDirectory="/tmp"145mkdir "$tmpDirectory/filename"146```147148```js149// zx150const tmpDirectory = '/tmp'151await $`mkdir ${tmpDirectory}/filename`;152```153154```js155// Execa156const tmpDirectory = '/tmp'157await $`mkdir ${tmpDirectory}/filename`;158```159160[More info.](execution.md#concatenation)161162### Variable substitution163164```sh165# Bash166echo $LANG167```168169```js170// zx171await $`echo $LANG`;172```173174```js175// Execa176await $`echo ${process.env.LANG}`;177```178179[More info.](input.md#environment-variables)180181### Escaping182183```sh184# Bash185echo 'one two'186```187188```js189// zx190await $`echo ${'one two'}`;191```192193```js194// Execa195await $`echo ${'one two'}`;196```197198[More info.](escaping.md)199200### Escaping multiple arguments201202```sh203# Bash204echo 'one two' '$'205```206207```js208// zx209await $`echo ${['one two', '$']}`;210```211212```js213// Execa214await $`echo ${['one two', '$']}`;215```216217[More info.](execution.md#multiple-arguments)218219### Subcommands220221```sh222# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 223why, one step back
223echo "$(npm run build)"

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 224–227why, one step back
224```
225226```js227// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 228–229why, one step back
228const result = await $`npm run build`;
229await $`echo ${result}`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 230–233why, one step back
230```
231232```js233// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 234–235why, one step back
234const result = await $`npm run build`;
235await $`echo ${result}`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 236–243why, one step back
236```
237238[More info.](execution.md#subcommands)239240### Serial commands241242```sh243# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 244why, one step back
244npm run build && npm run test

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 245–248why, one step back
245```
246247```js248// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 249why, one step back
249await $`npm run build && npm run test`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 250–253why, one step back
250```
251252```js253// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 254–255why, one step back
254await $`npm run build`;
255await $`npm run test`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 256–261why, one step back
256```
257258### Parallel commands259260```sh261# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 262–263why, one step back
262npm run build &
263npm run test &

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 264–267why, one step back
264```
265266```js267// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 268why, one step back
268await Promise.all([$`npm run build`, $`npm run test`]);

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 269–272why, one step back
269```
270271```js272// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 273why, one step back
273await Promise.all([$`npm run build`, $`npm run test`]);

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 274–280why, one step back
274```
275276### Global/shared options277278```sh279# Bash280options="timeout 5"

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 281–283why, one step back
281$options npm run init
282$options npm run build283$options npm run test

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 284–288why, one step back
284```
285286```js287// zx288const timeout = '5s';

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 289–291why, one step back
289await $`npm run init`.timeout(timeout);
290await $`npm run build`.timeout(timeout);291await $`npm run test`.timeout(timeout);

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 292–299why, one step back
292```
293294```js295// Execa296import {$ as $_} from 'execa';297298const $ = $_({timeout: 5000});299

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 300–302why, one step back
300await $`npm run init`;
301await $`npm run build`;302await $`npm run test`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 303–310why, one step back
303```
304305[More info.](execution.md#globalshared-options)306307### Environment variables308309```sh310# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 311why, one step back
311EXAMPLE=1 npm run build

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 312–316why, one step back
312```
313314```js315// zx316$.env.EXAMPLE = '1';

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 317why, one step back
317await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 318–322why, one step back
318delete $.env.EXAMPLE;
319```320321```js322// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 323why, one step back
323await $({env: {EXAMPLE: '1'}})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 324–381why, one step back
324```
325326[More info.](input.md#environment-variables)327328### Local binaries329330```sh331# Bash332npx tsc --version333```334335```js336// zx337await $`npx tsc --version`;338```339340```js341// Execa342await $`tsc --version`;343```344345[More info.](environment.md#local-binaries)346347### Builtin utilities348349```js350// zx351const content = await stdin();352```353354```js355// Execa356import getStdin from 'get-stdin';357358const content = await getStdin();359```360361### Printing to stdout362363```sh364# Bash365echo example366```367368```js369// zx370echo`example`;371```372373```js374// Execa375console.log('example');376```377378### Silent stderr379380```sh381# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 382why, one step back
382npm run build 2> /dev/null

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 383–386why, one step back
383```
384385```js386// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 387why, one step back
387await $`npm run build`.stdio('inherit', 'pipe', 'ignore');

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 388–391why, one step back
388```
389390```js391// Execa does not print stdout/stderr by default

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 392why, one step back
392await $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 393–399why, one step back
393```
394395### Verbose mode396397```sh398# Bash399set -v

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 400why, one step back
400npm run build

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 401–404why, one step back
401```
402403```js404// zx >=8

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 405why, one step back
405await $`npm run build`.verbose();

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 406–412why, one step back
406
407// or:408$.verbose = true;409```410411```js412// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 413why, one step back
413await $({verbose: 'full'})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 414–424why, one step back
414```
415416Or:417418```419NODE_DEBUG=execa node file.js420```421422Which prints:423424```

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 425–427why, one step back
425[19:49:00.360] [0] $ npm run build
426Building...427Done.

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 428–457why, one step back
428[19:49:00.383] [0] √ (done in 23ms)
429```430431[More info.](debugging.md#verbose-mode)432433### Piping stdout to another command434435```sh436# Bash437echo npm run build | sort | head -n2438```439440```js441// zx442await $`npm run build | sort | head -n2`;443```444445```js446// Execa447await $`npm run build`448 .pipe`sort`449 .pipe`head -n2`;450```451452[More info.](pipe.md)453454### Piping stdout and stderr to another command455456```sh457# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 458why, one step back
458npm run build |& cat

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 459–462why, one step back
459```
460461```js462// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 463why, one step back
463const subprocess = $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

line 464why, one step back
464const cat = $`cat`;

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 465–467why, one step back
465subprocess.pipe(cat);
466subprocess.stderr.pipe(cat.stdin);467await Promise.all([subprocess, cat]);

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 468–471why, one step back
468```
469470```js471// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 472why, one step back
472await $({all: true})`npm run build`

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 473–481why, one step back
473 .pipe({from: 'all'})`cat`;
474```475476[More info.](pipe.md#source-file-descriptor)477478### Piping stdout to a file479480```sh481# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 482why, one step back
482npm run build > output.txt

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 483–486why, one step back
483```
484485```js486// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

lines 487–489why, one step back
487import {createWriteStream} from 'node:fs';
488489await $`npm run build`.pipe(createWriteStream('output.txt'));

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 490–493why, one step back
490```
491492```js493// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 494why, one step back
494await $({stdout: {file: 'output.txt'}})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 495–502why, one step back
495```
496497[More info.](output.md#file-output)498499### Piping stdin from a file500501```sh502# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 503why, one step back
503cat < input.txt

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 504–634why, one step back
504```
505506```js507// zx508const cat = $`cat`;509fs.createReadStream('input.txt').pipe(cat.stdin);510await cat;511```512513```js514// Execa515await $({inputFile: 'input.txt'})`cat`;516```517518[More info.](input.md#file-input)519520### Iterate over output lines521522```sh523# Bash524while read525do526 if [[ "$REPLY" == *ERROR* ]]527 then528 echo "$REPLY"529 fi530done < <(npm run build)531```532533```js534// zx does not allow proper iteration.535// For example, the iteration does not handle subprocess errors.536```537538```js539// Execa540for await (const line of $`npm run build`) {541 if (line.includes('ERROR')) {542 console.log(line);543 }544}545```546547[More info.](lines.md#progressive-splitting)548549### Errors550551```sh552# Bash communicates errors only through the exit code and stderr553timeout 1 sleep 2554echo $?555```556557```js558// zx559const {560 stdout,561 stderr,562 exitCode,563 signal,564} = await $`sleep 2`.timeout('1s');565// file:///home/me/Desktop/node_modules/zx/build/core.js:146566// let output = new ProcessOutput(code, signal, stdout, stderr, combined, message);567// ^568// ProcessOutput [Error]:569// at file:///home/me/Desktop/example.js:2:20570// exit code: null571// signal: SIGTERM572// at ChildProcess.<anonymous> (file:///home/me/Desktop/node_modules/zx/build/core.js:146:26)573// at ChildProcess.emit (node:events:512:28)574// at maybeClose (node:internal/child_process:1098:16)575// at Socket.<anonymous> (node:internal/child_process:456:11)576// at Socket.emit (node:events:512:28)577// at Pipe.<anonymous> (node:net:316:12)578// at Pipe.callbackTrampoline (node:internal/async_hooks:130:17) {579// _code: null,580// _signal: 'SIGTERM',581// _stdout: '',582// _stderr: '',583// _combined: ''584// }585```586587```js588// Execa589const {590 stdout,591 stderr,592 exitCode,593 signal,594 signalDescription,595 originalMessage,596 shortMessage,597 command,598 escapedCommand,599 failed,600 timedOut,601 isCanceled,602 isTerminated,603 isMaxBuffer,604 // and other error-related properties: code, etc.605} = await $({timeout: 1})`sleep 2`;606// ExecaError: Command timed out after 1 milliseconds: sleep 2607// at file:///home/me/Desktop/example.js:2:20608// at ... {609// shortMessage: 'Command timed out after 1 milliseconds: sleep 2\nTimed out',610// originalMessage: '',611// command: 'sleep 2',612// escapedCommand: 'sleep 2',613// cwd: '/path/to/cwd',614// durationMs: 19.95693,615// failed: true,616// timedOut: true,617// isCanceled: false,618// isTerminated: true,619// isMaxBuffer: false,620// signal: 'SIGTERM',621// signalDescription: 'Termination',622// stdout: '',623// stderr: '',624// stdio: [undefined, '', ''],625// pipedFrom: []626// }627```628629[More info.](errors.md)630631### Exit codes632633```sh634# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 635why, one step back
635npm run build

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 636–640why, one step back
636echo $?
637```638639```js640// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 641why, one step back
641const {exitCode} = await $`npm run build`.nothrow();

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 642–646why, one step back
642echo`${exitCode}`;
643```644645```js646// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 647why, one step back
647const {exitCode} = await $({reject: false})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 648–656why, one step back
648console.log(exitCode);
649```650651[More info.](errors.md#exit-code)652653### Timeouts654655```sh656# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 657why, one step back
657timeout 5 npm run build

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 658–661why, one step back
658```
659660```js661// zx

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 662why, one step back
662await $`npm run build`.timeout('5s');

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 663–666why, one step back
663```
664665```js666// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 667why, one step back
667await $({timeout: 5000})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 668–742why, one step back
668```
669670[More info.](termination.md#timeout)671672### Current filename673674```sh675# Bash676echo "$(basename "$0")"677```678679```js680// zx681await $`echo ${__filename}`;682```683684```js685// Execa686await $`echo ${import.meta.filename}`;687```688689### Current directory690691```sh692# Bash693cd project694```695696```js697// zx698cd('project');699700// or:701$.cwd = 'project';702```703704```js705// Execa706const $$ = $({cwd: 'project'});707```708709[More info.](environment.md#current-directory)710711### Multiple current directories712713```sh714# Bash715pushd project716pwd717popd718pwd719```720721```js722// zx723within(async () => {724 cd('project');725 await $`pwd`;726});727728await $`pwd`;729```730731```js732// Execa733await $({cwd: 'project'})`pwd`;734await $`pwd`;735```736737[More info.](environment.md#current-directory)738739### Background subprocess740741```sh742# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 743why, one step back
743npm run build &

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 744–751why, one step back
744```
745746```js747// zx does not allow setting the `detached` option748```749750```js751// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 752why, one step back
752await $({detached: true})`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 753–848why, one step back
753```
754755[More info.](environment.md#background-subprocess)756757### IPC758759```sh760# Bash does not allow simple IPC761```762763```js764// zx does not allow simple IPC765```766767```js768// Execa769const subprocess = $({ipc: true})`node script.js`;770771subprocess.on('message', message => {772 if (message === 'ping') {773 subprocess.send('pong');774 }775});776```777778[More info.](ipc.md)779780### Transforms781782```sh783# Bash does not allow transforms784```785786```js787// zx does not allow transforms788```789790```js791// Execa792const transform = function * (line) {793 if (!line.includes('secret')) {794 yield line;795 }796};797798await $({stdout: [transform, 'inherit']})`echo ${'This is a secret.'}`;799```800801[More info.](transform.md)802803### Cancelation804805```sh806# Bash807kill $PID808```809810```js811// zx812subprocess.kill();813```814815```js816// Execa817// Can specify an error message and stack trace818subprocess.kill(error);819820// Or use an `AbortSignal`821const controller = new AbortController();822await $({signal: controller.signal})`node long-script.js`;823```824825[More info.](termination.md#canceling)826827### Interleaved output828829```sh830# Bash prints stdout and stderr interleaved831```832833```js834// zx separates stdout and stderr835const {stdout, stderr} = await $`node example.js`;836```837838```js839// Execa can interleave stdout and stderr840const {all} = await $({all: true})`node example.js`;841```842843[More info.](output.md#interleaved-output)844845### PID846847```sh848# Bash

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 849why, one step back
849npm run build &

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 850–858why, one step back
850echo $!
851```852853```js854// zx does not return `subprocess.pid`855```856857```js858// Execa

Improve documentation (#1003)ehmickybefore adoptionc8a6ed7

line 859why, one step back
859const {pid} = $`npm run build`;

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 860–865why, one step back
860```
861862[More info.](termination.md#inter-process-termination)863864<hr>865

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

line 866why, one step back
866[**Next**: 📔 API reference](api.md)\

Add user guides (#989)ehmickybefore adoptionbe91ecf

lines 867–868why, one step back
867[**Previous**: 📎 Windows](windows.md)\
868[**Top**: Table of contents](../readme.md#documentation)