(script_bin_path: P, args: Vec<String>)
| 4 | use {Result, ResultExt}; |
| 5 | |
| 6 | pub fn run_script<P: AsRef<Path>>(script_bin_path: P, args: Vec<String>) -> Result<()> { |
| 7 | let cmd_path = script_bin_path.as_ref(); |
| 8 | let mut command = Command::new(cmd_path); |
| 9 | if !args.is_empty() { |
| 10 | println!("Using arguments: {:?}", &args); |
| 11 | command.args(&args); |
| 12 | } |
| 13 | let mut script_process = command.spawn() |
| 14 | .chain_err(|| "Unable to spawn script")?; |
| 15 | let script_result = script_process.wait().chain_err(|| "Script crashed")?; |
| 16 | terminate_like_script(script_result); |
| 17 | } |
| 18 | |
| 19 | #[cfg(not(unix))] |
| 20 | fn terminate_like_script(exit_status: ExitStatus) -> ! { |
no test coverage detected