Skip to content

Function: exec()

Documentation / @wtf/platform / process / exec

function exec(
spawn,
command,
args,
__namedParameters?
): Promise<ExecResult>;

Defined in: packages/platform/src/process.ts:111

Runs command by spawn to its end, as execFile of Node and Deno’s output() do: writes input to its stdin, and ends it, and gives what it wrote to its stdout and stderr, as text, and the code it exited with. A process that exits with a code but 0 resolves, with its code: the caller decides what a code means. One that could not start rejects with the SystemError of its status; one whose signal is aborted is ended, and rejects with the signal’s reason.

const { stdout } = await exec(platform.spawn, 'git', ['status', '--porcelain'])

Parameters

ParameterType
spawnSpawn
commandstring
argsreadonly string[]
__namedParametersExecOptions

Returns

Promise<ExecResult>