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

Function argStringToArray

github-actions/browserstack/set-browserstack-env.js:20387–20430  ·  view source on GitHub ↗
(argString)

Source from the content-addressed store, hash-verified

20385 }
20386 step((generator = generator.apply(thisArg, _arguments || [])).next());
20387 });
20388 };
20389 function which(tool, check) {
20390 return __awaiter3(this, void 0, void 0, function* () {
20391 if (!tool) {
20392 throw new Error("parameter 'tool' is required");
20393 }
20394 if (check) {
20395 const result = yield which(tool, false);
20396 if (!result) {
20397 if (IS_WINDOWS) {
20398 throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
20399 } else {
20400 throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
20401 }
20402 }
20403 return result;
20404 }
20405 const matches = yield findInPath(tool);
20406 if (matches && matches.length > 0) {
20407 return matches[0];
20408 }
20409 return "";
20410 });
20411 }
20412 function findInPath(tool) {
20413 return __awaiter3(this, void 0, void 0, function* () {
20414 if (!tool) {
20415 throw new Error("parameter 'tool' is required");
20416 }
20417 const extensions = [];
20418 if (IS_WINDOWS && process.env["PATHEXT"]) {
20419 for (const extension of process.env["PATHEXT"].split(path2.delimiter)) {
20420 if (extension) {
20421 extensions.push(extension);
20422 }
20423 }
20424 }
20425 if (isRooted(tool)) {
20426 const filePath = yield tryGetExecutablePath(tool, extensions);
20427 if (filePath) {
20428 return [filePath];
20429 }
20430 return [];
20431 }
20432 if (tool.includes(path2.sep)) {
20433 return [];

Callers 1

execFunction · 0.70

Calls 2

appendFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected