Fix broken pipe panics
This commit is contained in:
parent
5e78a43242
commit
876c1cb9af
2 changed files with 12 additions and 4 deletions
|
@ -50,6 +50,8 @@ extern crate libimagutil;
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
|
use libimagerror::exit::ExitUnwrap;
|
||||||
|
use libimagerror::io::ToExitCode;
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
|
|
||||||
mod create;
|
mod create;
|
||||||
|
@ -77,8 +79,9 @@ fn main() {
|
||||||
if rt.is_ok() {
|
if rt.is_ok() {
|
||||||
rt.unwrap()
|
rt.unwrap()
|
||||||
} else {
|
} else {
|
||||||
println!("Could not set up Runtime");
|
let mut out = ::std::io::stdout();
|
||||||
println!("{:?}", rt.err().unwrap());
|
let _ = writeln!(out, "Could not set up Runtime").to_exit_code().unwrap_or_exit();
|
||||||
|
let _ = writeln!(out, "{:?}", rt.err().unwrap()).to_exit_code().unwrap_or_exit();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,11 @@ extern crate libimagmail;
|
||||||
extern crate libimagerror;
|
extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
use libimagerror::trace::{MapErrTrace, trace_error};
|
use libimagerror::trace::{MapErrTrace, trace_error};
|
||||||
|
use libimagerror::exit::ExitUnwrap;
|
||||||
|
use libimagerror::io::ToExitCode;
|
||||||
use libimagmail::mail::Mail;
|
use libimagmail::mail::Mail;
|
||||||
use libimagrt::runtime::Runtime;
|
use libimagrt::runtime::Runtime;
|
||||||
use libimagrt::setup::generate_runtime_setup;
|
use libimagrt::setup::generate_runtime_setup;
|
||||||
|
@ -106,12 +110,13 @@ fn list(rt: &Runtime) {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("Mail: {id}\n\tFrom: {from}\n\tTo: {to}\n\t{subj}\n",
|
writeln!(::std::io::stdout(),
|
||||||
|
"Mail: {id}\n\tFrom: {from}\n\tTo: {to}\n\t{subj}\n",
|
||||||
from = from,
|
from = from,
|
||||||
id = id,
|
id = id,
|
||||||
subj = subject,
|
subj = subject,
|
||||||
to = to
|
to = to
|
||||||
);
|
).to_exit_code().unwrap_or_exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = rt.store()
|
let _ = rt.store()
|
||||||
|
|
Loading…
Reference in a new issue