[][src]Function run_script::run_or_exit

pub fn run_or_exit(
    script: &str,
    args: &Vec<String>,
    options: &ScriptOptions
) -> (String, String)

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

Example

extern crate run_script;

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);
}