Add some debugging output

This commit is contained in:
Matthias Beyer 2016-09-02 09:48:02 +02:00
parent 389c5b9033
commit 352d7e9083

View file

@ -186,6 +186,8 @@ fn main() {
}); });
} }
debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args);
match Command::new(format!("imag-{}", subcommand)) match Command::new(format!("imag-{}", subcommand))
.stdin(Stdio::inherit()) .stdin(Stdio::inherit())
.stdout(Stdio::inherit()) .stdout(Stdio::inherit())
@ -196,12 +198,15 @@ fn main() {
{ {
Ok(exit_status) => { Ok(exit_status) => {
if !exit_status.success() { if !exit_status.success() {
debug!("{} exited with non-zero exit code: {:?}", subcommand, exit_status);
println!("{} exited with non-zero exit code", subcommand); println!("{} exited with non-zero exit code", subcommand);
exit(exit_status.code().unwrap_or(42)); exit(exit_status.code().unwrap_or(42));
} }
debug!("Successful exit!");
}, },
Err(e) => { Err(e) => {
debug!("Error calling the subcommand");
match e.kind() { match e.kind() {
ErrorKind::NotFound => { ErrorKind::NotFound => {
println!("No such command: 'imag-{}'", subcommand); println!("No such command: 'imag-{}'", subcommand);