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

Function which

github-actions/browserstack/set-browserstack-env.js:19983–20005  ·  view source on GitHub ↗
(tool, check)

Source from the content-addressed store, hash-verified

19981 });
19982 };
19983 function which(tool, check) {
19984 return __awaiter3(this, void 0, void 0, function* () {
19985 if (!tool) {
19986 throw new Error("parameter 'tool' is required");
19987 }
19988 if (check) {
19989 const result = yield which(tool, false);
19990 if (!result) {
19991 if (IS_WINDOWS) {
19992 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.`);
19993 } else {
19994 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.`);
19995 }
19996 }
19997 return result;
19998 }
19999 const matches = yield findInPath(tool);
20000 if (matches && matches.length > 0) {
20001 return matches[0];
20002 }
20003 return "";
20004 });
20005 }
20006 function findInPath(tool) {
20007 return __awaiter3(this, void 0, void 0, function* () {
20008 if (!tool) {

Callers 1

execMethod · 0.70

Calls 2

__awaiter3Function · 0.70
findInPathFunction · 0.70

Tested by

no test coverage detected