MCPcopy Create free account
hub / github.com/faern/rustscript / run_script

Function run_script

src/runner.rs:6–17  ·  view source on GitHub ↗
(script_bin_path: P, args: Vec<String>)

Source from the content-addressed store, hash-verified

4use {Result, ResultExt};
5
6pub 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))]
20fn terminate_like_script(exit_status: ExitStatus) -> ! {

Callers 1

runFunction · 0.85

Calls 1

terminate_like_scriptFunction · 0.85

Tested by

no test coverage detected