fix(install): emit hook exe paths with forward slashes so Git Bash does not strip them#1988
Closed
varuntej07 wants to merge 1 commit into
Closed
fix(install): emit hook exe paths with forward slashes so Git Bash does not strip them#1988varuntej07 wants to merge 1 commit into
varuntej07 wants to merge 1 commit into
Conversation
…es not strip them Claude Code runs command-type PreToolUse hooks through Git Bash by default on Windows. The resolved exe was emitted as a raw backslash path and quoted only when it contained a space, so a space-free path like C:\Users\me\graphify.EXE reached settings.json unquoted. Git Bash treats the unquoted backslashes as escapes and strips them, producing 'C:Usersmegraphify.EXE: command not found', so every graph guard silently fails. Normalize the path to forward slashes in _resolve_graphify_exe (a no-op on POSIX), fixing the Claude, Gemini, and Codex hook emitters at once.
Collaborator
|
Landed on v8 and shipped in 0.9.20 (faa0ac2), cherry-picked to preserve your authorship. Thanks @varuntej07 — hook exe paths are normalized to forward slashes at the single choke point (_resolve_graphify_exe), so Git Bash no longer strips them; covers all emitters and preserves quoting + the --strict suffix. |
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.
On Windows,
graphify claude installwrote the PreToolUse hook command as a raw backslash path (quoted only when it contained a space). Claude Code runs command-type hooks through Git Bash by default on Windows ("Defaults tobash, or topowershellon Windows when Git Bash isn't installed"), and bash strips the unquoted backslashes, soC:\Users\me\graphify.EXE hook-guard searchbecomesC:Usersmegraphify.EXE: command not found. Every graph guard silently fails.Fix: normalize the resolved exe to forward slashes in
_resolve_graphify_exe(), which feeds the Claude/CodeBuddy, Gemini, and Codex hook emitters. Forward slashes work under Git Bash, cmd.exe, and PowerShell, and the replacement is a no-op on POSIX. Added a cross-platform regression test that monkeypatches a backslash path and asserts the emitted command has none.Closes #1987