From 6faf40651169bfeba5314fca6ef540b09d07ba41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leynier=20Guti=C3=A9rrez=20Gonz=C3=A1lez?= Date: Fri, 1 May 2026 19:50:22 -0600 Subject: [PATCH] fix(claude-hook): use forward slashes in Windows managed hook command path (#1329) Co-authored-by: Amp --- src/main/claude/hook-service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/claude/hook-service.ts b/src/main/claude/hook-service.ts index 587967ec629..bea3d2fe419 100644 --- a/src/main/claude/hook-service.ts +++ b/src/main/claude/hook-service.ts @@ -48,7 +48,15 @@ function getManagedScriptPath(): string { } function getManagedCommand(scriptPath: string): string { - return process.platform === 'win32' ? scriptPath : `/bin/sh "${scriptPath}"` + // Why: on Windows, Claude Code runs hooks through Git Bash (`/usr/bin/bash`). + // A path with single backslashes (e.g. `C:\Users\…\claude-hook.cmd`) is + // interpreted by bash as a string with escape sequences, so `\U`, `\A`, etc. + // collapse and the launcher fails with `command not found`. Emit forward + // slashes — Windows accepts them in path arguments and bash leaves them + // intact, so the same JSON value works through every shell layer. + return process.platform === 'win32' + ? scriptPath.replaceAll('\\', '/') + : `/bin/sh "${scriptPath}"` } function getManagedScript(): string {