Commit 8e39f06c authored by PERE Alexandre's avatar PERE Alexandre

Merge branch '32-only-first-argument-accounted-for-in-the-runaway-exec-command' into 'master'

Resolve "Only first argument accounted for, in the runaway exec command"

Closes #32

See merge request !20
parents ea619fdb 7859d692
......@@ -277,9 +277,12 @@ fn extract_args_iter(matches: &clap::ArgMatches) -> Result<Box<dyn std::iter::It
.map(|l| misc::expand_template_string(&l).into_iter())
.flatten()))
} else {
let content = matches.value_of("ARGUMENTS").unwrap();
debug!("Arguments tempolate found: {}", content);
Ok(Box::new(misc::expand_template_string(content).into_iter()))
let content = match matches.values_of("ARGUMENTS"){
Some(it) => it.fold(String::new(), |acc, arg| format!("{} {}", acc, arg)),
None => "".to_owned()
};
debug!("Arguments template found: {}", content);
Ok(Box::new(misc::expand_template_string(&content).into_iter()))
}
}
......
......@@ -32,7 +32,6 @@ use tracing::{self, info, error, debug};
/// Executes a single execution of the script with the command arguments and returns exit code.
pub fn exec(matches: clap::ArgMatches) -> Result<Exit, Exit>{
// We initialize the logger
misc::init_logger(&matches);
......@@ -60,7 +59,10 @@ pub fn exec(matches: clap::ArgMatches) -> Result<Exit, Exit>{
}
push_env(&mut store, "RUNAWAY_LEAVE", format!("{}", leave));
debug!("Leave option set to {}", leave);
let parameters = matches.value_of("ARGUMENTS").unwrap_or("").to_owned();
let parameters = match matches.values_of("ARGUMENTS"){
Some(it) => it.fold(String::new(), |acc, arg| format!("{} {}", acc, arg)),
None => "".to_owned()
};
push_env(&mut store, "RUNAWAY_ARGUMENTS", parameters.clone());
debug!("Arguments set to {}", parameters);
let script = PathBuf::from(matches.value_of("SCRIPT").unwrap());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment