GitHub image
execa
⌘K
Exports
Readme
Functions
5
execa
Docs
Import
Tests
3
References
2

Execute a file.

Think of this as a mix of child_process.execFile and child_process.spawn.

function execa(

The program/script to execute.

file: string,

Arguments to pass to file on execution.

arguments?: ReadonlyArray<string>,
options?: Options<string>
): any+3
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import {execa} from 'execa';
const {stdout} = await execa('echo', ['unicorns']);
console.log(stdout);
//=> 'unicorns'
// Cancelling a spawned process
const subprocess = execa('node');
setTimeout(() => {
subprocess.cancel()
}, 1000);
try {
await subprocess;
} catch (error) {
console.log(subprocess.killed); // true
console.log(error.isCanceled); // true
}
// Pipe the child process stdout to the current stdout
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
execaSync
Docs
Import
Tests
3
References
2

Execute a file synchronously.

This method throws an Error if the command fails.

function execaSync(

The program/script to execute.

file: string,

Arguments to pass to file on execution.

arguments?: ReadonlyArray<string>,
options?: SyncOptions<string>
): ExecaSyncReturnValue<string>+3
execaCommand
Docs
Import
Tests
3
References
2

Same as execa() except both file and arguments are specified in a single command string. For example, execa('echo', ['unicorns']) is the same as execaCommand('echo unicorns').

If the file or an argument contains spaces, they must be escaped with backslashes. This matters especially if command is not a constant but a variable, for example with __dirname or process.cwd(). Except for spaces, no escaping/quoting is needed.

The shell option must be used if the command uses shell-specific features (for example, && or ||), as opposed to being a simple file followed by its arguments.

function execaCommand(

The program/script to execute and its arguments.

command: string,
options?: Options<string>
): any+1
Example
1
2
3
4
5
6
import {execaCommand} from 'execa';
const {stdout} = await execaCommand('echo unicorns');
console.log(stdout);
//=> 'unicorns'
execaCommandSync
Docs
Import
Tests
3
References
2

Same as execaCommand() but synchronous.

function execaCommandSync(

The program/script to execute and its arguments.

command: string,
options?: SyncOptions<string>
): ExecaSyncReturnValue<string>+1
execaNode
Docs
Import
Tests
3
References
2

Execute a Node.js script as a child process.

Same as execa('node', [scriptPath, ...arguments], options) except (like child_process#fork()): - the current Node version and options are used. This can be overridden using the nodePath and nodeArguments options. - the shell option cannot be used - an extra channel ipc is passed to stdio

function execaNode(

Node.js script to execute.

scriptPath: string,

Arguments to pass to scriptPath on execution.

arguments?: ReadonlyArray<string>,
options?: NodeOptions<string>
): any+3
Type Aliases
2
StdioOption
Docs
Import
Tests
3
References
2
type StdioOption = any
ExecaChildProcess
Docs
Import
Tests
3
References
2
type ExecaChildProcess = any
Interfaces
11
CommonOptions
Docs
Import
Tests
3
References
2
interface CommonOptions<EncodingType'> {

Kill the spawned process when the parent process exits unless either: - the spawned process is detached - the parent process is terminated abruptly, for example, with SIGKILL as opposed to SIGTERM or a normal exit

cleanup?: boolean

Prefer locally installed binaries when looking for a binary to execute.

If you `$ npm install foo`, you can then `execa('foo')`.
preferLocal?: boolean

Preferred path to find locally installed binaries in (use with preferLocal).

localDir?: string

Path to the Node.js executable to use in child processes.

This can be either an absolute path or a path relative to the `cwd` option. Requires `preferLocal` to be `true`. For 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.
execPath?: string

Buffer the output from the spawned process. When set to false, you must read the output of stdout and stderr (or all if the all option is true). Otherwise the returned promise will not be resolved/rejected.

If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
buffer?: boolean

Same options as stdio.

stdin?: any

Same options as stdio.

stdout?: any

Same options as stdio.

stderr?: any

Setting this to false resolves the promise with the error instead of rejecting it.

reject?: boolean

Add an .all property on the promise and the resolved value. The property contains the output of the process with stdout and stderr interleaved.

all?: boolean

Strip the final newline character from the output.

stripFinalNewline?: boolean

Set to false if you don't want to extend the environment variables when providing the env property.

extendEnv?: boolean

Current working directory of the child process.

cwd?: string

Environment key-value pairs. Extends automatically from process.env. Set extendEnv to false if you don't want this.

env?: any

Explicitly set the value of argv[0] sent to the child process. This will be set to command or file if not specified.

argv0?: string

Child's stdio configuration.

stdio?: ReadonlyArray<any> | "pipe" | "ignore" | "inherit"

Specify the kind of serialization used for sending messages between processes when using the stdio: 'ipc' option or execaNode(): - json: Uses JSON.stringify() and JSON.parse(). - advanced: Uses v8.serialize()

Requires Node.js `13.2.0` or later. [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
serialization?: "json" | "advanced"

Prepare child to run independently of its parent process. Specific behavior depends on the platform.

detached?: boolean

Sets the user identity of the process.

uid?: number

Sets the group identity of the process.

gid?: number

If true, runs command 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.

We recommend against using this option since it is: - not cross-platform, encouraging shell-specific syntax. - slower, because of the additional shell interpretation. - unsafe, potentially allowing command injection.
shell?: string | false | true

Specify the character encoding used to decode the stdout and stderr output. If set to null, then stdout and stderr will be a Buffer instead of a string.

encoding?: EncodingType'

If timeout is greater than 0, the parent will send the signal identified by the killSignal property (the default is SIGTERM) if the child runs longer than timeout milliseconds.

timeout?: number

Largest amount of data in bytes allowed on stdout or stderr. Default: 100 MB.

maxBuffer?: number

Signal value to be used when the spawned process will be killed.

killSignal?: string | number

If 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.

windowsVerbatimArguments?: boolean

On Windows, do not create a new console window. Please note this also prevents CTRL-C from working on Windows.

windowsHide?: boolean
}
Options
Docs
Import
Tests
3
References
2
interface Options<EncodingType' = string> {

Write some input to the stdin of your binary.

input?: any

Kill the spawned process when the parent process exits unless either: - the spawned process is detached - the parent process is terminated abruptly, for example, with SIGKILL as opposed to SIGTERM or a normal exit

cleanup?: boolean

Prefer locally installed binaries when looking for a binary to execute.

If you `$ npm install foo`, you can then `execa('foo')`.
preferLocal?: boolean

Preferred path to find locally installed binaries in (use with preferLocal).

localDir?: string

Path to the Node.js executable to use in child processes.

This can be either an absolute path or a path relative to the `cwd` option. Requires `preferLocal` to be `true`. For 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.
execPath?: string

Buffer the output from the spawned process. When set to false, you must read the output of stdout and stderr (or all if the all option is true). Otherwise the returned promise will not be resolved/rejected.

If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
buffer?: boolean

Same options as stdio.

stdin?: any

Same options as stdio.

stdout?: any

Same options as stdio.

stderr?: any

Setting this to false resolves the promise with the error instead of rejecting it.

reject?: boolean

Add an .all property on the promise and the resolved value. The property contains the output of the process with stdout and stderr interleaved.

all?: boolean

Strip the final newline character from the output.

stripFinalNewline?: boolean

Set to false if you don't want to extend the environment variables when providing the env property.

extendEnv?: boolean

Current working directory of the child process.

cwd?: string

Environment key-value pairs. Extends automatically from process.env. Set extendEnv to false if you don't want this.

env?: any

Explicitly set the value of argv[0] sent to the child process. This will be set to command or file if not specified.

argv0?: string

Child's stdio configuration.

stdio?: ReadonlyArray<any> | "pipe" | "ignore" | "inherit"

Specify the kind of serialization used for sending messages between processes when using the stdio: 'ipc' option or execaNode(): - json: Uses JSON.stringify() and JSON.parse(). - advanced: Uses v8.serialize()

Requires Node.js `13.2.0` or later. [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
serialization?: "json" | "advanced"

Prepare child to run independently of its parent process. Specific behavior depends on the platform.

detached?: boolean

Sets the user identity of the process.

uid?: number

Sets the group identity of the process.

gid?: number

If true, runs command 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.

We recommend against using this option since it is: - not cross-platform, encouraging shell-specific syntax. - slower, because of the additional shell interpretation. - unsafe, potentially allowing command injection.
shell?: string | false | true

Specify the character encoding used to decode the stdout and stderr output. If set to null, then stdout and stderr will be a Buffer instead of a string.

encoding?: EncodingType'

If timeout is greater than 0, the parent will send the signal identified by the killSignal property (the default is SIGTERM) if the child runs longer than timeout milliseconds.

timeout?: number

Largest amount of data in bytes allowed on stdout or stderr. Default: 100 MB.

maxBuffer?: number

Signal value to be used when the spawned process will be killed.

killSignal?: string | number

If 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.

windowsVerbatimArguments?: boolean

On Windows, do not create a new console window. Please note this also prevents CTRL-C from working on Windows.

windowsHide?: boolean
}
SyncOptions
Docs
Import
Tests
3
References
2
interface SyncOptions<EncodingType' = string> {

Write some input to the stdin of your binary.

input?: any

Kill the spawned process when the parent process exits unless either: - the spawned process is detached - the parent process is terminated abruptly, for example, with SIGKILL as opposed to SIGTERM or a normal exit

cleanup?: boolean

Prefer locally installed binaries when looking for a binary to execute.

If you `$ npm install foo`, you can then `execa('foo')`.
preferLocal?: boolean

Preferred path to find locally installed binaries in (use with preferLocal).

localDir?: string

Path to the Node.js executable to use in child processes.

This can be either an absolute path or a path relative to the `cwd` option. Requires `preferLocal` to be `true`. For 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.
execPath?: string

Buffer the output from the spawned process. When set to false, you must read the output of stdout and stderr (or all if the all option is true). Otherwise the returned promise will not be resolved/rejected.

If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
buffer?: boolean

Same options as stdio.

stdin?: any

Same options as stdio.

stdout?: any

Same options as stdio.

stderr?: any

Setting this to false resolves the promise with the error instead of rejecting it.

reject?: boolean

Add an .all property on the promise and the resolved value. The property contains the output of the process with stdout and stderr interleaved.

all?: boolean

Strip the final newline character from the output.

stripFinalNewline?: boolean

Set to false if you don't want to extend the environment variables when providing the env property.

extendEnv?: boolean

Current working directory of the child process.

cwd?: string

Environment key-value pairs. Extends automatically from process.env. Set extendEnv to false if you don't want this.

env?: any

Explicitly set the value of argv[0] sent to the child process. This will be set to command or file if not specified.

argv0?: string

Child's stdio configuration.

stdio?: ReadonlyArray<any> | "pipe" | "ignore" | "inherit"

Specify the kind of serialization used for sending messages between processes when using the stdio: 'ipc' option or execaNode(): - json: Uses JSON.stringify() and JSON.parse(). - advanced: Uses v8.serialize()

Requires Node.js `13.2.0` or later. [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
serialization?: "json" | "advanced"

Prepare child to run independently of its parent process. Specific behavior depends on the platform.

detached?: boolean

Sets the user identity of the process.

uid?: number

Sets the group identity of the process.

gid?: number

If true, runs command 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.

We recommend against using this option since it is: - not cross-platform, encouraging shell-specific syntax. - slower, because of the additional shell interpretation. - unsafe, potentially allowing command injection.
shell?: string | false | true

Specify the character encoding used to decode the stdout and stderr output. If set to null, then stdout and stderr will be a Buffer instead of a string.

encoding?: EncodingType'

If timeout is greater than 0, the parent will send the signal identified by the killSignal property (the default is SIGTERM) if the child runs longer than timeout milliseconds.

timeout?: number

Largest amount of data in bytes allowed on stdout or stderr. Default: 100 MB.

maxBuffer?: number

Signal value to be used when the spawned process will be killed.

killSignal?: string | number

If 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.

windowsVerbatimArguments?: boolean

On Windows, do not create a new console window. Please note this also prevents CTRL-C from working on Windows.

windowsHide?: boolean
}
NodeOptions
Docs
Import
Tests
3
References
2
interface NodeOptions<EncodingType' = string> {

The Node.js executable to use.

nodePath?: string

List of CLI options passed to the Node.js executable.

nodeOptions?: string[]

Write some input to the stdin of your binary.

input?: any

Kill the spawned process when the parent process exits unless either: - the spawned process is detached - the parent process is terminated abruptly, for example, with SIGKILL as opposed to SIGTERM or a normal exit

cleanup?: boolean

Prefer locally installed binaries when looking for a binary to execute.

If you `$ npm install foo`, you can then `execa('foo')`.
preferLocal?: boolean

Preferred path to find locally installed binaries in (use with preferLocal).

localDir?: string

Path to the Node.js executable to use in child processes.

This can be either an absolute path or a path relative to the `cwd` option. Requires `preferLocal` to be `true`. For 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.
execPath?: string

Buffer the output from the spawned process. When set to false, you must read the output of stdout and stderr (or all if the all option is true). Otherwise the returned promise will not be resolved/rejected.

If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.
buffer?: boolean

Same options as stdio.

stdin?: any

Same options as stdio.

stdout?: any

Same options as stdio.

stderr?: any

Setting this to false resolves the promise with the error instead of rejecting it.

reject?: boolean

Add an .all property on the promise and the resolved value. The property contains the output of the process with stdout and stderr interleaved.

all?: boolean

Strip the final newline character from the output.

stripFinalNewline?: boolean

Set to false if you don't want to extend the environment variables when providing the env property.

extendEnv?: boolean

Current working directory of the child process.

cwd?: string

Environment key-value pairs. Extends automatically from process.env. Set extendEnv to false if you don't want this.

env?: any

Explicitly set the value of argv[0] sent to the child process. This will be set to command or file if not specified.

argv0?: string

Child's stdio configuration.

stdio?: ReadonlyArray<any> | "pipe" | "ignore" | "inherit"

Specify the kind of serialization used for sending messages between processes when using the stdio: 'ipc' option or execaNode(): - json: Uses JSON.stringify() and JSON.parse(). - advanced: Uses v8.serialize()

Requires Node.js `13.2.0` or later. [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)
serialization?: "json" | "advanced"

Prepare child to run independently of its parent process. Specific behavior depends on the platform.

detached?: boolean

Sets the user identity of the process.

uid?: number

Sets the group identity of the process.

gid?: number

If true, runs command 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.

We recommend against using this option since it is: - not cross-platform, encouraging shell-specific syntax. - slower, because of the additional shell interpretation. - unsafe, potentially allowing command injection.
shell?: string | false | true

Specify the character encoding used to decode the stdout and stderr output. If set to null, then stdout and stderr will be a Buffer instead of a string.

encoding?: EncodingType'

If timeout is greater than 0, the parent will send the signal identified by the killSignal property (the default is SIGTERM) if the child runs longer than timeout milliseconds.

timeout?: number

Largest amount of data in bytes allowed on stdout or stderr. Default: 100 MB.

maxBuffer?: number

Signal value to be used when the spawned process will be killed.

killSignal?: string | number

If 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.

windowsVerbatimArguments?: boolean

On Windows, do not create a new console window. Please note this also prevents CTRL-C from working on Windows.

windowsHide?: boolean
}
ExecaReturnBase
Docs
Import
Tests
3
References
2
interface ExecaReturnBase<StdoutStderrType'> {

The file and arguments that were run, for logging purposes.

This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
command: string

Same as command but escaped.

This is meant to be copy and pasted into a shell, for debugging purposes. Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
escapedCommand: string

The numeric exit code of the process that was run.

exitCode: number

The output of the process on stdout.

stdout: StdoutStderrType'

The output of the process on stderr.

stderr: StdoutStderrType'

Whether the process failed to run.

failed: boolean

Whether the process timed out.

timedOut: boolean

Whether the process was killed.

killed: boolean

The name of the signal that was used to terminate the process. For example, SIGFPE.

If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
signal?: string

A human-friendly description of the signal that was used to terminate the process. For example, Floating point arithmetic error.

If 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.
signalDescription?: string
}
ExecaSyncReturnValue
Docs
Import
Tests
3
References
2
interface ExecaSyncReturnValue<StdoutErrorType' = string> {

The file and arguments that were run, for logging purposes.

This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
command: string

Same as command but escaped.

This is meant to be copy and pasted into a shell, for debugging purposes. Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
escapedCommand: string

The numeric exit code of the process that was run.

exitCode: number

The output of the process on stdout.

stdout: StdoutStderrType'

The output of the process on stderr.

stderr: StdoutStderrType'

Whether the process failed to run.

failed: boolean

Whether the process timed out.

timedOut: boolean

Whether the process was killed.

killed: boolean

The name of the signal that was used to terminate the process. For example, SIGFPE.

If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
signal?: string

A human-friendly description of the signal that was used to terminate the process. For example, Floating point arithmetic error.

If 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.
signalDescription?: string
}
ExecaReturnValue
Docs
Import
Tests
3
References
2

Result of a child process execution. On success this is a plain object. On failure this is also an Error instance.

The child process fails when:

  • its exit code is not 0
  • it was killed with a signal
  • timing out
  • being canceled
  • there's not enough memory or there are already too many child processes
interface ExecaReturnValue<StdoutErrorType' = string> {

The output of the process with stdout and stderr interleaved.

This is `undefined` if either: - the `all` option is `false` (default value) - `execaSync()` was used
all?: StdoutErrorType'

Whether the process was canceled.

isCanceled: boolean

The file and arguments that were run, for logging purposes.

This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
command: string

Same as command but escaped.

This is meant to be copy and pasted into a shell, for debugging purposes. Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
escapedCommand: string

The numeric exit code of the process that was run.

exitCode: number

The output of the process on stdout.

stdout: StdoutStderrType'

The output of the process on stderr.

stderr: StdoutStderrType'

Whether the process failed to run.

failed: boolean

Whether the process timed out.

timedOut: boolean

Whether the process was killed.

killed: boolean

The name of the signal that was used to terminate the process. For example, SIGFPE.

If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
signal?: string

A human-friendly description of the signal that was used to terminate the process. For example, Floating point arithmetic error.

If 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.
signalDescription?: string
}
ExecaSyncError
Docs
Import
Tests
3
References
2
interface ExecaSyncError<StdoutErrorType' = string> {

Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.

The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
message: string

This is the same as the message property except it does not include the child process stdout/stderr.

shortMessage: string

Original error message. This is the same as the message property except it includes neither the child process stdout/stderr nor some additional information added by Execa.

This is `undefined` unless the child process exited due to an `error` event or a timeout.
originalMessage?: string
name: string
stack?: string

The file and arguments that were run, for logging purposes.

This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
command: string

Same as command but escaped.

This is meant to be copy and pasted into a shell, for debugging purposes. Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
escapedCommand: string

The numeric exit code of the process that was run.

exitCode: number

The output of the process on stdout.

stdout: StdoutStderrType'

The output of the process on stderr.

stderr: StdoutStderrType'

Whether the process failed to run.

failed: boolean

Whether the process timed out.

timedOut: boolean

Whether the process was killed.

killed: boolean

The name of the signal that was used to terminate the process. For example, SIGFPE.

If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
signal?: string

A human-friendly description of the signal that was used to terminate the process. For example, Floating point arithmetic error.

If 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.
signalDescription?: string
}
ExecaError
Docs
Import
Tests
3
References
2
interface ExecaError<StdoutErrorType' = string> {

The output of the process with stdout and stderr interleaved.

This is `undefined` if either: - the `all` option is `false` (default value) - `execaSync()` was used
all?: StdoutErrorType'

Whether the process was canceled.

isCanceled: boolean

Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.

The child process stderr then stdout are appended to the end, separated with newlines and not interleaved.
message: string

This is the same as the message property except it does not include the child process stdout/stderr.

shortMessage: string

Original error message. This is the same as the message property except it includes neither the child process stdout/stderr nor some additional information added by Execa.

This is `undefined` unless the child process exited due to an `error` event or a timeout.
originalMessage?: string
name: string
stack?: string

The file and arguments that were run, for logging purposes.

This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.
command: string

Same as command but escaped.

This is meant to be copy and pasted into a shell, for debugging purposes. Since the escaping is fairly basic, this should not be executed directly as a process, including using `execa()` or `execaCommand()`.
escapedCommand: string

The numeric exit code of the process that was run.

exitCode: number

The output of the process on stdout.

stdout: StdoutStderrType'

The output of the process on stderr.

stderr: StdoutStderrType'

Whether the process failed to run.

failed: boolean

Whether the process timed out.

timedOut: boolean

Whether the process was killed.

killed: boolean

The name of the signal that was used to terminate the process. For example, SIGFPE.

If a signal terminated the process, this property is defined and included in the error message. Otherwise it is `undefined`.
signal?: string

A human-friendly description of the signal that was used to terminate the process. For example, Floating point arithmetic error.

If 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.
signalDescription?: string
}
KillOptions
Docs
Import
Tests
3
References
2
interface KillOptions {

Milliseconds to wait for the child process to terminate before sending SIGKILL.

Can be disabled with `false`.
forceKillAfterTimeout?: number | false
}
ExecaChildPromise
Docs
Import
Tests
3
References
2
interface ExecaChildPromise<StdoutErrorType'> {

Stream combining/interleaving stdout and stderr.

This is `undefined` if either: - the `all` option is `false` (the default value) - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio)
all?: any
catch: <ResultType'>(
onRejected?: (
reason: ExecaError<StdoutErrorType'>
) => (ResultType' | PromiseLike<ResultType'>)
) => Promise<(ResultType' | ExecaReturnValue<StdoutErrorType'>)>

Same as the original child_process#kill(), except if signal is SIGTERM (the default value) and the child process is not terminated after 5 seconds, force it by sending SIGKILL.

kill: (signal?: string, options?: KillOptions) => void

Similar to childProcess.kill(). This is preferred when cancelling the child process execution as the error is more descriptive and childProcessResult.isCanceled is set to true.

cancel: () => void
}
Description
Process execution for humans
Install
yarn add execa
Copy
Details
MIT License
9 Dependencies
Native TypeScript Package
Metrics
Weekly Downloads