mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 22:06:26 +00:00
Change to ignore broken pipe error
This commit is contained in:
parent
6522337463
commit
943ac87466
@ -2,7 +2,7 @@ extern crate exa;
|
||||
use exa::Exa;
|
||||
|
||||
use std::env::args;
|
||||
use std::io::stdout;
|
||||
use std::io::{stdout, stderr, Write, ErrorKind};
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
@ -10,9 +10,17 @@ fn main() {
|
||||
let mut stdout = stdout();
|
||||
|
||||
match Exa::new(&args, &mut stdout) {
|
||||
Ok(mut exa) => exa.run().expect("IO error"),
|
||||
Ok(mut exa) => if let Err(e) = exa.run() {
|
||||
match e.kind() {
|
||||
ErrorKind::BrokenPipe => exit(0),
|
||||
_ => {
|
||||
writeln!(stderr(), "{}", e).unwrap();
|
||||
exit(1);
|
||||
},
|
||||
};
|
||||
},
|
||||
Err(e) => {
|
||||
println!("{}", e);
|
||||
writeln!(stderr(), "{}", e).unwrap();
|
||||
exit(e.error_code());
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user