MCPcopy Create free account
hub / github.com/angular/dev-infra / exec

Method exec

github-actions/bazel/configure-remote/configure-remote.js:20288–20388  ·  view source on GitHub ↗

* Exec a tool. * Output will be streamed to the live console. * Returns promise with return code * * @param tool path to tool to exec * @param options optional exec options. See ExecOptions * @returns number

()

Source from the content-addressed store, hash-verified

20286 needsQuotes = true;
20287 break;
20288 }
20289 }
20290 if (!needsQuotes) {
20291 return arg;
20292 }
20293 let reverse = '"';
20294 let quoteHit = true;
20295 for (let i = arg.length; i > 0; i--) {
20296 reverse += arg[i - 1];
20297 if (quoteHit && arg[i - 1] === "\\") {
20298 reverse += "\\";
20299 } else if (arg[i - 1] === '"') {
20300 quoteHit = true;
20301 reverse += '"';
20302 } else {
20303 quoteHit = false;
20304 }
20305 }
20306 reverse += '"';
20307 return reverse.split("").reverse().join("");
20308 }
20309 _uvQuoteCmdArg(arg) {
20310 if (!arg) {
20311 return '""';
20312 }
20313 if (!arg.includes(" ") && !arg.includes(" ") && !arg.includes('"')) {
20314 return arg;
20315 }
20316 if (!arg.includes('"') && !arg.includes("\\")) {
20317 return `"${arg}"`;
20318 }
20319 let reverse = '"';
20320 let quoteHit = true;
20321 for (let i = arg.length; i > 0; i--) {
20322 reverse += arg[i - 1];
20323 if (quoteHit && arg[i - 1] === "\\") {
20324 reverse += "\\";
20325 } else if (arg[i - 1] === '"') {
20326 quoteHit = true;
20327 reverse += "\\";
20328 } else {
20329 quoteHit = false;
20330 }
20331 }
20332 reverse += '"';
20333 return reverse.split("").reverse().join("");
20334 }
20335 _cloneExecOptions(options) {
20336 options = options || {};
20337 const result = {
20338 cwd: options.cwd || process.cwd(),
20339 env: options.env || process.env,
20340 silent: options.silent || false,
20341 windowsVerbatimArguments: options.windowsVerbatimArguments || false,
20342 failOnStdErr: options.failOnStdErr || false,
20343 ignoreReturnCode: options.ignoreReturnCode || false,
20344 delay: options.delay || 1e4
20345 };

Callers 2

parseMetadataFunction · 0.45
execFunction · 0.45

Calls 15

__awaiter4Function · 0.70
isRootedFunction · 0.70
whichFunction · 0.70
existsFunction · 0.70
_debugMethod · 0.45
_cloneExecOptionsMethod · 0.45
writeMethod · 0.45
_getCommandStringMethod · 0.45
onMethod · 0.45
_getSpawnFileNameMethod · 0.45
_getSpawnArgsMethod · 0.45
_getSpawnOptionsMethod · 0.45

Tested by

no test coverage detected