MCPcopy Create free account
hub / github.com/Snapchat/Valdi / runCliCommand

Function runCliCommand

npm_modules/cli/src/utils/cliUtils.ts:9–20  ·  view source on GitHub ↗
(command: string, cwd?: string, rejectOnFailure?: boolean)

Source from the content-addressed store, hash-verified

7export type CliChoice<T> = { name: string; value: T };
8
9export function runCliCommand(command: string, cwd?: string, rejectOnFailure?: boolean): Promise<CommandResult> {
10 return new Promise((resolve, reject) => {
11 exec(command, { cwd: cwd, shell: getShell() }, (error, stdout, stderr) => {
12 const returnCode = error ? (error.code ?? 1) : 0;
13 if (returnCode !== 0 && rejectOnFailure) {
14 reject(new Error(stderr.trim()));
15 } else {
16 resolve({ returnCode, stdout, stderr });
17 }
18 });
19 });
20}
21
22export function spawnCliCommand(
23 command: string,

Callers 14

tryAdbForwardFunction · 0.90
runCommandMethod · 0.90
attemptAutoFixMethod · 0.90
checkNodeVersionMethod · 0.90
checkJavaInstallationMethod · 0.90
checkEditorExtensionsMethod · 0.90
checkSingleDependencyMethod · 0.90

Calls 4

getShellFunction · 0.85
rejectFunction · 0.85
resolveFunction · 0.50
trimMethod · 0.45

Tested by

no test coverage detected