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

Method exec

github-actions/browserstack/set-browserstack-env.js:20285–20385  ·  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

20283 }
20284 }
20285 function step(result) {
20286 result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
20287 }
20288 step((generator = generator.apply(thisArg, _arguments || [])).next());
20289 });
20290 };
20291 var IS_WINDOWS2 = process.platform === "win32";
20292 var ToolRunner = class extends events.EventEmitter {
20293 constructor(toolPath, args, options) {
20294 super();
20295 if (!toolPath) {
20296 throw new Error("Parameter 'toolPath' cannot be null or empty.");
20297 }
20298 this.toolPath = toolPath;
20299 this.args = args || [];
20300 this.options = options || {};
20301 }
20302 _debug(message) {
20303 if (this.options.listeners && this.options.listeners.debug) {
20304 this.options.listeners.debug(message);
20305 }
20306 }
20307 _getCommandString(options, noPrefix) {
20308 const toolPath = this._getSpawnFileName();
20309 const args = this._getSpawnArgs(options);
20310 let cmd = noPrefix ? "" : "[command]";
20311 if (IS_WINDOWS2) {
20312 if (this._isCmdFile()) {
20313 cmd += toolPath;
20314 for (const a of args) {
20315 cmd += ` ${a}`;
20316 }
20317 } else if (options.windowsVerbatimArguments) {
20318 cmd += `"${toolPath}"`;
20319 for (const a of args) {
20320 cmd += ` ${a}`;
20321 }
20322 } else {
20323 cmd += this._windowsQuoteCmdArg(toolPath);
20324 for (const a of args) {
20325 cmd += ` ${this._windowsQuoteCmdArg(a)}`;
20326 }
20327 }
20328 } else {
20329 cmd += toolPath;
20330 for (const a of args) {
20331 cmd += ` ${a}`;
20332 }
20333 }
20334 return cmd;
20335 }
20336 _processLineBuffer(data, strBuffer, onLine) {
20337 try {
20338 let s = strBuffer + data.toString();
20339 let n = s.indexOf(os3.EOL);
20340 while (n > -1) {
20341 const line = s.substring(0, n);
20342 onLine(line);

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