-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(windows): improve Claude CLI scan for paths with spaces #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
06bfa47
a1e2fcd
7aecd24
7237fd9
8cf1d2b
4e3d738
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,8 +59,10 @@ async function validateClaudeCliAsync(cliPath: string): Promise<[boolean, string | |
| // Get cmd.exe path from environment or use default | ||
| const cmdExe = process.env.ComSpec | ||
| || path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'cmd.exe'); | ||
| // Use double-quoted command line for paths with spaces | ||
| const cmdLine = `""${cliPath}" --version"`; | ||
| // Use chcp 65001 to set UTF-8 code page for proper error message encoding. | ||
| // Note: Using simple quoting because /s flag only strips outer quotes when | ||
| // command STARTS with a quote - since we prepend 'chcp', use standard quoting. | ||
| const cmdLine = `chcp 65001 >nul && "${cliPath}" --version`; | ||
| const execOptions: ExecFileAsyncOptionsWithVerbatim = { | ||
| encoding: 'utf-8', | ||
| timeout: 5000, | ||
|
|
@@ -147,7 +149,14 @@ async function scanClaudeInstallations(activePath: string | null): Promise<Claud | |
| const result = await execFileAsync('where', ['claude'], { timeout: 5000 }); | ||
| const paths = result.stdout.trim().split('\n').filter(p => p.trim()); | ||
| for (const p of paths) { | ||
| await addInstallation(p.trim(), 'system-path'); | ||
| const trimmed = p.trim(); | ||
| // On Windows, skip extensionless paths - they're not directly executable. | ||
| // Only consider .cmd, .exe, .bat files which are the actual executables. | ||
| if (!/\.(cmd|exe|bat)$/i.test(trimmed)) { | ||
| console.log('[Claude Code] Skipping non-executable path:', trimmed); | ||
| continue; | ||
| } | ||
| await addInstallation(trimmed, 'system-path'); | ||
|
Comment on lines
+152
to
+159
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a great fix for handling extensionless paths from the The |
||
| } | ||
| } else { | ||
| const result = await execFileAsync('which', ['-a', 'claude'], { timeout: 5000 }); | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.