in eng/scripts/helper.js [51:85]
export function run(command, args, options) {
if (!options || !options.silent) {
console.log();
console.log(`> ${command} ${args.join(" ")}`);
}
options = {
stdio: "inherit",
sync: true,
throwOnNonZeroExit: true,
...options,
};
if (process.platform === "win32" && isCmdOnWindows.includes(command)) {
command += ".cmd";
// Required in latest versions of Node when calling batch files on Windows
options.shell = true;
}
const proc = (options.sync ? spawnSync : spawn)(command, args, options);
if (proc.error) {
if (options.ignoreCommandNotFound && proc.error.code === "ENOENT") {
console.log(`Skipped: Command \`${command}\` not found.`);
} else {
throw proc.error;
}
} else if (options.throwOnNonZeroExit && proc.status !== undefined && proc.status !== 0) {
throw new CommandFailedError(
`Command \`${command} ${args.join(" ")}\` failed with exit code ${proc.status}`,
proc
);
}
return proc;
}