fix: prevent false positive Claude Code conflict on Windows
Windows installers create multiple entry points in the same directory (e.g. claude.exe + claude, claude.cmd + claude). These are variants for different shells, not separate installations. Deduplicate by directory + base name stripped of executable extensions (.exe/.cmd/.bat). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
a187f320ec
commit
e6f333567d
1 file changed
+9
@@ -143,6 +143,15 @@ export function findAllClaudeBinaries(): ClaudeInstallInfo[] {
|
||||
try { realPath = fs.realpathSync(p); } catch { realPath = p; }
|
||||
if (seenReal.has(realPath)) return;
|
||||
|
||||
// On Windows, installers create multiple variants in the same directory:
|
||||
// native: claude.exe + claude (shell script), npm: claude.cmd + claude, etc.
|
||||
// Deduplicate by dir + base name stripped of all executable extensions.
|
||||
if (isWindows) {
|
||||
const dirKey = path.join(path.dirname(realPath), path.basename(realPath).replace(/\.(exe|cmd|bat)$/i, '')).toLowerCase();
|
||||
if (seenReal.has(dirKey)) return;
|
||||
seenReal.add(dirKey);
|
||||
}
|
||||
|
||||
const out = execFileSync(p, ['--version'], {
|
||||
timeout: 3000,
|
||||
stdio: 'pipe',
|
||||
|
||||
Reference in new issue
Block a user