Skip to content

resolveCommand

View as Markdown
function resolveCommand(
cmd,
args?,
o?
): Promise<
| ResolvedCommand
| null>;

Defined in: node/exe.ts:246

Finds cmd like findCommand and makes it startable without a shell. POSIX: the file found. Windows: a .exe/.com directly; an npm .cmd shim becomes its Node + JS target (or its .exe target); any other .cmd/.bat runs through the absolute cmd.exe (/d /s /c) with every argument quoted. Null when nothing is found. Throws UnsafeCommandError when a .cmd/.bat cannot be started safely (no absolute cmd.exe, or an argument with ", %, !, ^ or a line break).

Parameter Type Default value
cmd string undefined
args? string[] []
o? ResolveOptions {}

Promise< | ResolvedCommand | null>