| 6565 | } |
| 6566 | |
| 6567 | static int cbm_remove_factory_hooks(const char *settings_path, const char *binary_path) { |
| 6568 | char command[CLI_BUF_8K]; |
| 6569 | char released_command[CLI_BUF_8K]; |
| 6570 | if (cbm_build_augment_dialect_command(binary_path, "factory", command, sizeof(command)) != |
| 6571 | CLI_OK || |
| 6572 | cbm_build_augment_command(binary_path, released_command, sizeof(released_command)) != |
| 6573 | CLI_OK) { |
| 6574 | return CLI_ERR; |
| 6575 | } |
| 6576 | const char *const old_commands[] = {released_command, NULL}; |
| 6577 | int session_result = remove_hooks_json((hooks_remove_args_t){ |
| 6578 | .settings_path = settings_path, |
| 6579 | .hook_event = "SessionStart", |
| 6580 | .matcher_str = NULL, |
| 6581 | .old_commands = old_commands, |
| 6582 | .match_command_exact = command, |
| 6583 | }); |
| 6584 | int read_result = remove_hooks_json((hooks_remove_args_t){ |
| 6585 | .settings_path = settings_path, |
| 6586 | .hook_event = "PostToolUse", |
| 6587 | .matcher_str = "Read", |
| 6588 | .match_command_exact = command, |
| 6589 | }); |
| 6590 | return session_result == CLI_OK && read_result == CLI_OK ? CLI_OK : CLI_ERR; |
| 6591 | } |
| 6592 | |
| 6593 | enum { AUGMENT_HOOK_TIMEOUT_MS = 5000 }; |
| 6594 |
no test coverage detected