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 libimagerror::exit::ExitUnwrap;
|
||||
use libimagerror::io::ToExitCode;
|
||||
use libimagrt::runtime::Runtime;
|
||||
|
||||
mod create;
|
||||
|
@ -77,8 +79,9 @@ fn main() {
|
|||
if rt.is_ok() {
|
||||
rt.unwrap()
|
||||
} else {
|
||||
println!("Could not set up Runtime");
|
||||
println!("{:?}", rt.err().unwrap());
|
||||
let mut out = ::std::io::stdout();
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,11 @@ extern crate libimagmail;
|
|||
extern crate libimagerror;
|
||||
extern crate libimagutil;
|
||||
|
||||
use std::io::Write;
|
||||
|
||||
use libimagerror::trace::{MapErrTrace, trace_error};
|
||||
use libimagerror::exit::ExitUnwrap;
|
||||
use libimagerror::io::ToExitCode;
|
||||
use libimagmail::mail::Mail;
|
||||
use libimagrt::runtime::Runtime;
|
||||
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,
|
||||
id = id,
|
||||
subj = subject,
|
||||
to = to
|
||||
);
|
||||
).to_exit_code().unwrap_or_exit()
|
||||
}
|
||||
|
||||
let _ = rt.store()
|
||||
|
|
Loading…
Reference in a new issue