Skip to main content

execute_hook

Function execute_hook 

Source
pub fn execute_hook(
    event: HookEvent,
    unit: &Unit,
    project_dir: &Path,
    reason: Option<String>,
) -> Result<bool, Error>
Expand description

Execute a hook script with the given payload.

§Arguments

  • event - The hook event to trigger
  • unit - The unit to pass to the hook
  • project_dir - The project root directory (parent of .mana/)
  • reason - Optional reason (used for pre-close hooks)

§Returns

  • Ok(true) - Hook passed (exit 0), or hook doesn’t exist, or hooks not trusted
  • Ok(false) - Hook executed but returned non-zero exit code
  • Err - Hook exists but not executable, timeout, or I/O error