fix: auto-detect git-bash path on Windows for Claude CLI (closes #23)#25
Closed
gy212 wants to merge 1 commit intoop7418:mainfrom
Closed
fix: auto-detect git-bash path on Windows for Claude CLI (closes #23)#25gy212 wants to merge 1 commit intoop7418:mainfrom
gy212 wants to merge 1 commit intoop7418:mainfrom
Conversation
Windows 上 Git 安装在非标准路径时,Claude CLI 因找不到 bash.exe 而以退出码 1 退出。 新增 findGitBash() 函数,按优先级自动检测 git-bash 路径: 1. 环境变量 CLAUDE_CODE_GIT_BASH_PATH(用户手动设置) 2. 常见安装路径(C:\Program Files\Git\bin\bash.exe 等) 3. 通过 where git 命令推导 Git 安装目录 在构建 SDK 子进程环境变量时自动设置 CLAUDE_CODE_GIT_BASH_PATH。
Owner
|
Closing: this feature has already been implemented in main (findGitBash() in src/lib/platform.ts + auto-detection in src/lib/claude-client.ts). Thank you for the contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Windows 上 Git 安装在非标准路径(如
D:\APP\Git)时,Claude CLI 无法找到bash.exe,进程以退出码 1 退出:修复
在
src/lib/platform.ts新增findGitBash()函数,按优先级自动检测 git-bash 路径:CLAUDE_CODE_GIT_BASH_PATH(用户手动设置)C:\Program Files\Git\bin\bash.exe、C:\Program Files (x86)\Git\bin\bash.exe)where git推导 — 定位git.exe,从其路径推导 Git 安装目录,拼接bin\bash.exe在
src/lib/claude-client.ts构建 SDK 子进程环境变量时,仅在 Windows 平台且CLAUDE_CODE_GIT_BASH_PATH未设置时调用该函数,将检测结果写入环境变量。修改文件
src/lib/platform.tsfindGitBash()导出函数src/lib/claude-client.tssdkEnv时调用自动检测从 #24 拆分
按作者建议,从 PR #24 中拆分出此独立修复。Bug 1(#22)因 main 分支已移除
ApiConfigSection组件需另行处理。