Skip to content

Commit cfe6703

Browse files
ryanbas21claude
andcommitted
fix(vscode): probe PATH for chromium/chrome binary instead of hardcoding first candidate
findChromePath() now uses `which` (or `where` on Windows) to check each candidate actually exists before returning it. Fixes detection on Arch Linux where the binary is `chromium` not `google-chrome`. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d82ad9e commit cfe6703

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/devtools-extension/packages/vscode-extension

Whitespace-only changes.

packages/vscode-extension/src/launch/chrome-launcher.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { spawn, type ChildProcess } from 'node:child_process';
1+
import { spawn, execFileSync, type ChildProcess } from 'node:child_process';
22
import { mkdtempSync } from 'node:fs';
33
import { join } from 'node:path';
44
import { tmpdir } from 'node:os';
@@ -35,7 +35,19 @@ export function buildChromeArgs(options: LaunchOptions): string[] {
3535
export function findChromePath(): string | undefined {
3636
const platform = process.platform as 'linux' | 'darwin' | 'win32';
3737
const candidates = CHROME_PATHS[platform] ?? [];
38-
return candidates[0];
38+
for (const candidate of candidates) {
39+
try {
40+
// For absolute paths, check if the file exists via which/where
41+
// For bare names, check if they're on PATH
42+
execFileSync(platform === 'win32' ? 'where' : 'which', [candidate], {
43+
stdio: 'ignore',
44+
});
45+
return candidate;
46+
} catch {
47+
// Not found, try next candidate
48+
}
49+
}
50+
return undefined;
3951
}
4052

4153
export function launchChrome(options: LaunchOptions): ChildProcess {

0 commit comments

Comments
 (0)