Skip to content

Function: nodeSpawn()

Documentation / @wtf/platform-node / process / nodeSpawn

function nodeSpawn(__namedParameters?): Spawn;

Defined in: packages/platform-node/src/process.ts:40

Node’s spawn: starts command by spawn of node:child_process, with no shell, each of its pipes a Web Stream, by Writable.toWeb and Readable.toWeb. A process is given its options’ env whole, or else env of the platform, its variables that are set, or else Node’s own; and works in its options’ cwd, or else the process’s. Its signal, aborted, ends it by SIGTERM, and its status says so: { code: 143, signal: 'SIGTERM' }. One that could not start rejects its status with a SystemError, NotFound of a command not there.

const spawn = nodeSpawn({ env: platform.env })
const { stdout } = await exec(spawn, 'git', ['rev-parse', 'HEAD'])

Parameters

ParameterType
__namedParameters{ env?: Readonly<Record<string, string | undefined>>; }
__namedParameters.env?Readonly<Record<string, string | undefined>>

Returns

Spawn