| 5678 | } |
| 5679 | |
| 5680 | static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) { |
| 5681 | char command[CLI_BUF_8K]; |
| 5682 | char released_command[CLI_BUF_8K]; |
| 5683 | if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) != |
| 5684 | CLI_OK || |
| 5685 | cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) != |
| 5686 | CLI_OK) { |
| 5687 | return CLI_ERR; |
| 5688 | } |
| 5689 | const char *const old_commands[] = {released_command, NULL}; |
| 5690 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 5691 | .settings_path = settings_path, |
| 5692 | .hook_event = "SessionStart", |
| 5693 | .matcher_str = NULL, |
| 5694 | .old_commands = old_commands, |
| 5695 | .match_command_exact = command, |
| 5696 | }); |
| 5697 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 5698 | .settings_path = settings_path, |
| 5699 | .hook_event = "PostToolUse", |
| 5700 | .matcher_str = "Read", |
| 5701 | .match_command_exact = command, |
| 5702 | }); |
| 5703 | return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR; |
| 5704 | } |
| 5705 | |
| 5706 | enum { AUGMENT_HOOK_TIMEOUT_MS = 5000 }; |
| 5707 |
no test coverage detected