Function run_script::run_or_exit
source · pub fn run_or_exit(
script: &str,
args: &Vec<String>,
options: &ScriptOptions
) -> (String, String)
Expand description
Invokes the provided script content and returns the invocation output. In case of invocation error or error exit code, this function will exit the main process.
Arguments
script
- The script contentargs
- The script command line argumentsoptions
- Options provided to the script runner
Example
use run_script::ScriptOptions;
fn main() {
let options = ScriptOptions::new();
let args = vec![];
let (output, error) = run_script::run_or_exit(
r#"
echo "Hello World"
"#,
&args,
&options
);
println!("Output: {}", output);
println!("Error: {}", error);
}