Skip to the content.

c8jsDocs


Function: exec()

exec(command, options)

exec(command, options?): Promise<Result>

Parameters

command: string | Promise<string>

options?: Options & Partial<Options>

Returns

Promise<Result>

exec(command, args, options)

exec(command, args?, options?): Promise<Result>

Executes a command, ensuring that temporary code coverage data is created.

This function does not spawn a shell to parse the command line, so don’t put any additional spaces or quotes around the command or the arguments.

Parameters

command: string | Promise<string>

The command to run. This can be a binary executable or a Node.js module. If a promise is specified, the resolved value will be used.

args?: readonly string[]

A list of arguments passed to the command.

options?: Options & Partial<Options>

Options for the function.

Returns

Promise<Result>

A promise that settles after the command has terminated. The promise will resolve with an object similar to the return value of child_process.spawnSync.