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

Method _getCommandString

github-actions/saucelabs/set-saucelabs-env.js:20093–20121  ·  view source on GitHub ↗
(options, noPrefix)

Source from the content-addressed store, hash-verified

20091 if (!p) {
20092 throw new Error('isRooted() parameter "p" cannot be empty');
20093 }
20094 if (IS_WINDOWS) {
20095 return p.startsWith("\\") || /^[A-Z]:/i.test(p);
20096 }
20097 return p.startsWith("/");
20098 }
20099 function tryGetExecutablePath(filePath, extensions) {
20100 return __awaiter2(this, void 0, void 0, function* () {
20101 let stats = void 0;
20102 try {
20103 stats = yield stat(filePath);
20104 } catch (err) {
20105 if (err.code !== "ENOENT") {
20106 console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
20107 }
20108 }
20109 if (stats && stats.isFile()) {
20110 if (IS_WINDOWS) {
20111 const upperExt = path.extname(filePath).toUpperCase();
20112 if (extensions.some((validExt) => validExt.toUpperCase() === upperExt)) {
20113 return filePath;
20114 }
20115 } else {
20116 if (isUnixExecutable(stats)) {
20117 return filePath;
20118 }
20119 }
20120 }
20121 const originalFilePath = filePath;
20122 for (const extension of extensions) {
20123 filePath = originalFilePath + extension;
20124 stats = void 0;

Callers 1

execMethod · 0.45

Calls 4

_getSpawnFileNameMethod · 0.45
_getSpawnArgsMethod · 0.45
_isCmdFileMethod · 0.45
_windowsQuoteCmdArgMethod · 0.45

Tested by

no test coverage detected