| 5734 | } |
| 5735 | |
| 5736 | static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) { |
| 5737 | char command[CLI_BUF_8K]; |
| 5738 | char released_command[CLI_BUF_8K]; |
| 5739 | if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) != |
| 5740 | CLI_OK || |
| 5741 | cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) != |
| 5742 | CLI_OK) { |
| 5743 | return CLI_ERR; |
| 5744 | } |
| 5745 | const char *const old_commands[] = {released_command, NULL}; |
| 5746 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 5747 | .settings_path = settings_path, |
| 5748 | .hook_event = "SessionStart", |
| 5749 | .matcher_str = NULL, |
| 5750 | .old_commands = old_commands, |
| 5751 | .match_command_exact = command, |
| 5752 | }); |
| 5753 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 5754 | .settings_path = settings_path, |
| 5755 | .hook_event = "PostToolUse", |
| 5756 | .matcher_str = "Read", |
| 5757 | .match_command_exact = command, |
| 5758 | }); |
| 5759 | return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR; |
| 5760 | } |
| 5761 | |
| 5762 | enum { AUGMENT_HOOK_TIMEOUT_MS = 5000 }; |
| 5763 |
no test coverage detected