Fix imag-view to ignore broken pipes
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
3e22fbe352
commit
a157b23258
1 changed files with 14 additions and 6 deletions
|
@ -209,9 +209,9 @@ fn main() {
|
||||||
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
|
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer
|
if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
|
||||||
.view_entry(&entry, &mut outlock)
|
handle_error(e);
|
||||||
.map_err_trace_exit_unwrap();
|
}
|
||||||
|
|
||||||
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
||||||
});
|
});
|
||||||
|
@ -243,9 +243,9 @@ fn main() {
|
||||||
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
|
.map(|s| writeln!(outlock, "{}", s).to_exit_code().unwrap_or_exit());
|
||||||
}
|
}
|
||||||
|
|
||||||
viewer
|
if let Err(e) = viewer.view_entry(&entry, &mut outlock) {
|
||||||
.view_entry(&entry, &mut outlock)
|
handle_error(e);
|
||||||
.map_err_trace_exit_unwrap();
|
}
|
||||||
|
|
||||||
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
rt.report_touched(entry.get_location()).unwrap_or_exit();
|
||||||
});
|
});
|
||||||
|
@ -285,3 +285,11 @@ fn create_tempfile_for<'a>(entry: &FileLockEntry<'a>, view_header: bool, hide_co
|
||||||
(tmpfile, file_path)
|
(tmpfile, file_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_error(e: ::libimagentryview::error::Error) {
|
||||||
|
use libimagentryview::error::Error;
|
||||||
|
match e {
|
||||||
|
Error::Io(e) => Err(e).to_exit_code().unwrap_or_exit(),
|
||||||
|
Error::Other(e) => Err(e).map_err_trace_exit_unwrap()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue