mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-26 22:06:26 +00:00
fix bug where a failed stat would cause the consumer thread to hang
This commit is contained in:
parent
53a723b4ba
commit
d9a0458a39
11
src/main.rs
11
src/main.rs
@ -69,7 +69,8 @@ impl<'a> Exa<'a> {
|
||||
// Communication between consumer thread and producer threads
|
||||
enum StatResult<'a> {
|
||||
File(File<'a>),
|
||||
Path(Path)
|
||||
Path(Path),
|
||||
Error
|
||||
}
|
||||
let (results_tx, results_rx) = channel();
|
||||
|
||||
@ -84,7 +85,8 @@ impl<'a> Exa<'a> {
|
||||
match results_rx.recv() {
|
||||
Ok(result) => match result {
|
||||
StatResult::File(file) => self.files.push(file),
|
||||
StatResult::Path(path) => self.dirs.push(path)
|
||||
StatResult::Path(path) => self.dirs.push(path),
|
||||
StatResult::Error => ()
|
||||
},
|
||||
Err(_) => unreachable!()
|
||||
}
|
||||
@ -116,7 +118,10 @@ impl<'a> Exa<'a> {
|
||||
let _ = results_tx.send(StatResult::File(File::with_stat(stat, &path, None, false)));
|
||||
}
|
||||
}
|
||||
Err(e) => println!("{}: {}", file, e),
|
||||
Err(e) => {
|
||||
println!("{}: {}", file, e);
|
||||
let _ = results_tx.send(StatResult::Error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user