()
| 13 | } |
| 14 | |
| 15 | export 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 | |
| 40 | export function toBashPath(filePath, pathStyle = 'git-bash') { |
| 41 | if (filePath.startsWith('/')) return filePath.replace(/\\/g, '/'); |
no outgoing calls
no test coverage detected