Fix broken pipe panics
This commit is contained in:
parent
849229eec6
commit
427ad89e55
1 changed files with 9 additions and 4 deletions
|
@ -28,6 +28,7 @@ extern crate libimagerror;
|
||||||
extern crate libimagutil;
|
extern crate libimagutil;
|
||||||
extern crate libimagstore;
|
extern crate libimagstore;
|
||||||
|
|
||||||
|
use std::io::Write;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
@ -39,6 +40,8 @@ use libimagstore::iter::get::StoreIdGetIteratorExtension;
|
||||||
use libimagnotes::note::Note;
|
use libimagnotes::note::Note;
|
||||||
use libimagnotes::notestore::*;
|
use libimagnotes::notestore::*;
|
||||||
use libimagerror::trace::MapErrTrace;
|
use libimagerror::trace::MapErrTrace;
|
||||||
|
use libimagerror::exit::ExitUnwrap;
|
||||||
|
use libimagerror::io::ToExitCode;
|
||||||
use libimagerror::iter::TraceIterator;
|
use libimagerror::iter::TraceIterator;
|
||||||
use libimagutil::info_result::*;
|
use libimagutil::info_result::*;
|
||||||
use libimagutil::warn_result::WarnResult;
|
use libimagutil::warn_result::WarnResult;
|
||||||
|
@ -116,6 +119,8 @@ fn edit(rt: &Runtime) {
|
||||||
fn list(rt: &Runtime) {
|
fn list(rt: &Runtime) {
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
let mut out = ::std::io::stdout();
|
||||||
|
|
||||||
let _ = rt
|
let _ = rt
|
||||||
.store()
|
.store()
|
||||||
.all_notes()
|
.all_notes()
|
||||||
|
@ -133,10 +138,10 @@ fn list(rt: &Runtime) {
|
||||||
})
|
})
|
||||||
.iter()
|
.iter()
|
||||||
.for_each(|note| {
|
.for_each(|note| {
|
||||||
note.get_name()
|
let name = note.get_name().map_err_trace_exit_unwrap(1);
|
||||||
.map(|name| println!("{}", name))
|
writeln!(out, "{}", name)
|
||||||
.map_err_trace()
|
.to_exit_code()
|
||||||
.ok();
|
.unwrap_or_exit()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue