Skip to content
Myr

Re-order options in `readme.md` (#800)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent c8a7961 · Browse files · 1 file+109 added−111 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+109 added−111 removed

  • other:+109 added−111 removed

1 file+109 added−111 removed

modified:readme.md+109 added-111 removed
480 unmodified lines
481### options482483Type: `object`484485#### cleanup485This lists all Execa options, including some options which are the same as 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).486487#### reject488489Type: `boolean`\490Default: `true`491490Kill the spawned process when the parent process exits unless either:491 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)492 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit492Setting this to `false` resolves the promise with the error instead of rejecting it.493494#### shell495496Type: `boolean | string | URL`\497Default: `false`498499If `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.500501We recommend against using this option since it is:502- not cross-platform, encouraging shell-specific syntax.503- slower, because of the additional shell interpretation.504- unsafe, potentially allowing command injection.505506#### cwd507508Type: `string | URL`\509Default: `process.cwd()`510511Current working directory of the child process.512513#### env514515Type: `object`\516Default: `process.env`517518Environment key-value pairs.519520Unless 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)).521522#### extendEnv523524Type: `boolean`\525Default: `true`526527If `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)).528If `false`, only the `env` option is used, not `process.env`.529530#### preferLocal531532Type: `boolean`\533Default: `true` with [`$`](#command), `false` otherwise
20 unmodified lines
554Requires [`preferLocal`](#preferlocal) to be `true`.555556For 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.557558#### nodePath *(For `.node()` only)*559560Type: `string | URL`\561Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)562563Node.js executable used to create the child process.564565#### nodeOptions *(For `.node()` only)*566567Type: `string[]`\568Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)569570List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.571572#### verbose573574Type: `boolean`\575Default: `false`576577[Print each command](#verbose-mode) on `stderr` before executing it.578579This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.580581#### buffer582583Type: `boolean`\584Default: `true`
109 unmodified lines
694- [`result.stdout`](#stdout), [`result.stderr`](#stderr), [`result.all`](#all-1) and [`result.stdio`](#stdio) are arrays of lines.695- [`childProcess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout), [`childProcess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr), [`childProcess.all`](#all) and [`childProcess.stdio`](https://nodejs.org/api/child_process.html#subprocessstdio) iterate over lines instead of arbitrary chunks.696- Any stream passed to the [`stdout`](#stdout-1), [`stderr`](#stderr-1) or [`stdio`](#stdio-1) option receives lines instead of arbitrary chunks.697639#### ipc698#### encoding699641Type: `boolean`\642Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise700Type: `string`\701Default: `utf8`702644Enables exchanging messages with the child process using [`childProcess.send(value)`](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback) and [`childProcess.on('message', (value) => {})`](https://nodejs.org/api/child_process.html#event-message).703Specify 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.704646#### reject647648Type: `boolean`\649Default: `true`650651Setting this to `false` resolves the promise with the error instead of rejecting it.652705#### stripFinalNewline706707Type: `boolean`\708Default: `true`709710Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.711660#### extendEnv712#### maxBuffer713662Type: `boolean`\663Default: `true`714Type: `number`\715Default: `100_000_000` (100 MB)716665If `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)).666If `false`, only the `env` option is used, not `process.env`.717Largest amount of data in bytes allowed on [`stdout`](#stdout), [`stderr`](#stderr) and [`stdio`](#stdio).718668---719#### ipc720670Execa 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)721Type: `boolean`\722Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise723672#### cwd724Enables exchanging messages with the child process using [`childProcess.send(value)`](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback) and [`childProcess.on('message', (value) => {})`](https://nodejs.org/api/child_process.html#event-message).725674Type: `string | URL`\675Default: `process.cwd()`676677Current working directory of the child process.678679#### env680681Type: `object`\682Default: `process.env`683684Environment key-value pairs.685686Unless 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)).687688#### argv0689690Type: `string`691692Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.693726#### serialization727728Type: `string`\729Default: `'json'`
9 unmodified lines
739Type: `boolean`740741Prepare 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).742711#### uid743#### cleanup744713Type: `number`745Type: `boolean`\746Default: `true`747715Sets the user identity of the process.748Kill the spawned process when the parent process exits unless either:749 - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)750 - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit751717#### gid718719Type: `number`720721Sets the group identity of the process.722723#### shell724725Type: `boolean | string | URL`\726Default: `false`727728If `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.729730We recommend against using this option since it is:731- not cross-platform, encouraging shell-specific syntax.732- slower, because of the additional shell interpretation.733- unsafe, potentially allowing command injection.734735#### encoding736737Type: `string`\738Default: `utf8`739740Specify 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.741752#### timeout753754Type: `number`\755Default: `0`756757If `timeout`` is greater than `0`, the child process will be [terminated](#killsignal) if it runs for longer than that amount of milliseconds.758749#### maxBuffer759#### signal760751Type: `number`\752Default: `100_000_000` (100 MB)761Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)762754Largest amount of data in bytes allowed on [`stdout`](#stdout), [`stderr`](#stderr) and [`stdio`](#stdio).763You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).764756#### killSignal765When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `true`.766758Type: `string | number`\759Default: `SIGTERM`760761Signal used to terminate the child process when:762- using the [`signal`](#signal-1), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option763- calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments764765This can be either a name (like `"SIGTERM"`) or a number (like `9`).766767#### forceKillAfterDelay768769Type: `number | false`\770Default: `5000`
12 unmodified lines
783- sending a termination signal from another process784785Also, 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.786787#### signal787#### killSignal788789Type: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)789Type: `string | number`\790Default: `SIGTERM`791791You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).792Signal used to terminate the child process when:793- using the [`signal`](#signal-1), [`timeout`](#timeout), [`maxBuffer`](#maxbuffer) or [`cleanup`](#cleanup) option794- calling [`subprocess.kill()`](https://nodejs.org/api/child_process.html#subprocesskillsignal) with no arguments795793When `AbortController.abort()` is called, [`.isCanceled`](#iscanceled) becomes `true`.796This can be either a name (like `"SIGTERM"`) or a number (like `9`).797795#### windowsVerbatimArguments798#### argv0799797Type: `boolean`\798Default: `false`800Type: `string`801800If `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`.802Explicitly set the value of `argv[0]` sent to the child process. This will be set to `file` if not specified.803802#### windowsHide804#### uid805804Type: `boolean`\805Default: `true`806Type: `number`807807On 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.808Sets the user identity of the process.809809#### verbose810#### gid811811Type: `boolean`\812Default: `false`812Type: `number`813814[Print each command](#verbose-mode) on `stderr` before executing it.814Sets the group identity of the process.815816This can also be enabled by setting the `NODE_DEBUG=execa` environment variable in the current process.816#### windowsVerbatimArguments817818#### nodePath *(For `.node()` only)*818Type: `boolean`\819Default: `false`820820Type: `string | URL`\821Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)821If `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`.822823Node.js executable used to create the child process.823#### windowsHide824825#### nodeOptions *(For `.node()` only)*825Type: `boolean`\826Default: `true`827827Type: `string[]`\828Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)828On 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.829830List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.831830## Tips831832### Redirect stdin/stdout/stderr to multiple destinations833
115 unmodified lines