Added in debug flag forwarding

This commit is contained in:
geemili 2016-07-19 13:43:48 -05:00
parent 3e7d921413
commit 182479d7af

View file

@ -125,6 +125,7 @@ fn main() {
}, },
}, },
}; };
let is_debug = env::args().skip(1).filter(|x| x == "--debug").next().is_some();
match &first_arg[..] { match &first_arg[..] {
"--help" | "-h" => { "--help" | "-h" => {
@ -157,11 +158,15 @@ fn main() {
}, },
s => { s => {
let subcommand_args = &find_args(s)[..];
if is_debug {
subcommand_args.push("--debug");
}
match Command::new(format!("imag-{}", s)) match Command::new(format!("imag-{}", s))
.stdin(Stdio::inherit()) .stdin(Stdio::inherit())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())
.stderr(Stdio::inherit()) .stderr(Stdio::inherit())
.args(&find_args(s)[..]) .args(subcommand_args)
.spawn() .spawn()
.and_then(|mut handle| handle.wait()) .and_then(|mut handle| handle.wait())
{ {