Resolve the exact shell-quoted command form shipped immediately before the * explicit Windows cmd.exe wrapper. It remains an ownership identity only. */
| 2510 | /* Resolve the exact shell-quoted command form shipped immediately before the |
| 2511 | * explicit Windows cmd.exe wrapper. It remains an ownership identity only. */ |
| 2512 | static int cbm_resolve_previous_hook_command(const char *script_name, char *out, size_t out_sz) { |
| 2513 | if (!cbm_hook_script_name_safe(script_name) || !out || out_sz == 0U) { |
| 2514 | return CLI_ERR; |
| 2515 | } |
| 2516 | char env_buf[CLI_BUF_1K]; |
| 2517 | const char *env = cbm_safe_getenv("CLAUDE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL); |
| 2518 | if (env && env[0]) { |
| 2519 | char path[CLI_BUF_1K]; |
| 2520 | int written = snprintf(path, sizeof(path), "%s/hooks/%s", env, script_name); |
| 2521 | return written > 0 && (size_t)written < sizeof(path) |
| 2522 | ? cbm_shell_quote_word(path, out, out_sz) |
| 2523 | : CLI_ERR; |
| 2524 | } |
| 2525 | int written = snprintf(out, out_sz, "\"$HOME/.claude/hooks/%s\"", script_name); |
| 2526 | return written > 0 && (size_t)written < out_sz ? CLI_OK : CLI_ERR; |
| 2527 | } |
| 2528 | |
| 2529 | /* Resolve only the exact command form shipped before hook paths were shell |
| 2530 | * quoted. This is an ownership identity for upgrade/uninstall, never a command |
no test coverage detected