From e6f333567dde8b3486feebb338633d50e0c06f0e Mon Sep 17 00:00:00 2001 From: 7418 <7418@openclaw.ai> Date: Fri, 13 Mar 2026 15:57:09 +0800 Subject: [PATCH] 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 --- src/lib/platform.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/platform.ts b/src/lib/platform.ts index 15636b5..27ef4ae 100644 --- a/src/lib/platform.ts +++ b/src/lib/platform.ts @@ -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',