MCPcopy Index your code
hub / github.com/rpamis/comet / findBashCommand

Function findBashCommand

scripts/benchmark-utils.mjs:15–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15export function findBashCommand() {
16 const candidates = [
17 process.env.COMET_BENCHMARK_BASH,
18 'bash',
19 ...(process.platform === 'win32'
20 ? [
21 'C:\\Program Files\\Git\\bin\\bash.exe',
22 'C:\\Program Files\\Git\\usr\\bin\\bash.exe',
23 'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
24 ]
25 : []),
26 ].filter(Boolean);
27 let wslFallback = null;
28 for (const candidate of [...new Set(candidates)]) {
29 const probe = spawnSync(candidate, ['-lc', 'uname -s'], { encoding: 'utf-8' });
30 if (probe.status !== 0 || !probe.stdout.trim()) continue;
31 if (process.platform === 'win32' && /linux/i.test(probe.stdout)) {
32 wslFallback = { command: candidate, pathStyle: 'wsl' };
33 continue;
34 }
35 return { command: candidate, pathStyle: 'git-bash' };
36 }
37 return wslFallback;
38}
39
40export function toBashPath(filePath, pathStyle = 'git-bash') {
41 if (filePath.startsWith('/')) return filePath.replace(/\\/g, '/');

Callers 2

generateHandoffFunction · 0.90
generateHandoffFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected