1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[cfg(test)]
#[path = "./generic_script_test.rs"]
mod generic_script_test;
use command;
use scriptengine::script_utils::{create_script_file, delete_file};
fn run_file(file: &str, runner: &String) -> bool {
let exit_code = command::run_command(runner, &Some(vec![file.to_string()]), false);
debug!("Executed generic script, exit code: {}", exit_code);
exit_code == 0
}
pub(crate) fn execute(script_text: &Vec<String>, runner: String, extension: String) {
let file = create_script_file(script_text, &extension);
let valid = run_file(&file, &runner);
delete_file(&file);
if !valid {
error!("Unable to execute generic script.");
}
}