| 5898 | } |
| 5899 | |
| 5900 | static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) { |
| 5901 | char command[CLI_BUF_8K]; |
| 5902 | char released_command[CLI_BUF_8K]; |
| 5903 | if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) != |
| 5904 | CLI_OK || |
| 5905 | cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) != |
| 5906 | CLI_OK) { |
| 5907 | return CLI_ERR; |
| 5908 | } |
| 5909 | const char *const old_commands[] = {released_command, NULL}; |
| 5910 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 5911 | .settings_path = settings_path, |
| 5912 | .hook_event = "SessionStart", |
| 5913 | .matcher_str = NULL, |
| 5914 | .old_commands = old_commands, |
| 5915 | .match_command_exact = command, |
| 5916 | }); |
| 5917 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 5918 | .settings_path = settings_path, |
| 5919 | .hook_event = "PostToolUse", |
| 5920 | .matcher_str = "Read", |
| 5921 | .match_command_exact = command, |
| 5922 | }); |
| 5923 | return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR; |
| 5924 | } |
| 5925 | |
| 5926 | enum { AUGMENT_HOOK_TIMEOUT_MS = 5000 }; |
| 5927 |
no test coverage detected