Enable arguments in action
fields of hooks
This commit is contained in:
parent
72a8a06c42
commit
ea19c7e413
1 changed files with 17 additions and 1 deletions
18
src/main.rs
18
src/main.rs
|
@ -61,7 +61,23 @@ fn execute_hook(name: &str, hook: &Hook, data: &serde_json::Value) -> Result<()>
|
|||
if let Some(action) = &hook.action {
|
||||
info!("Execute `{}` from hook `{}`", action, name);
|
||||
|
||||
Command::new(action).spawn()?;
|
||||
let action = action.split(" ").collect::<Vec<&str>>();
|
||||
|
||||
let command = Command::new(action[0]).args(&action[1..]).output()?;
|
||||
|
||||
info!(
|
||||
"Command `{}` exited with return code: {}",
|
||||
action[0], command.status
|
||||
);
|
||||
debug!(
|
||||
"Output of command `{}` on stderr: {:?}",
|
||||
action[0], &command.stderr
|
||||
);
|
||||
trace!(
|
||||
"Output of command `{}` on stdout: {:?}",
|
||||
action[0],
|
||||
&command.stdout
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue