fix(cli): Panic on broken pipe; use conditional match arm with ErrorKind
This commit is contained in:
parent
65dc922944
commit
dbdda25224
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use super::test_highlight;
|
||||
use std::fmt::Write;
|
||||
use std::io;
|
||||
use std::io::ErrorKind;
|
||||
use tree_sitter::{QueryError, QueryErrorKind};
|
||||
use walkdir;
|
||||
|
||||
|
|
@ -106,8 +107,8 @@ impl From<serde_json::Error> for Error {
|
|||
|
||||
impl From<io::Error> for Error {
|
||||
fn from(error: io::Error) -> Self {
|
||||
match error.raw_os_error() {
|
||||
Some(32) => return Error::new_ignored(), // Broken pipe
|
||||
match error {
|
||||
x if x.kind() == ErrorKind::BrokenPipe => return Error::new_ignored(),
|
||||
_ => (),
|
||||
}
|
||||
Error::new(error.to_string())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue