diff --git a/Cargo.lock b/Cargo.lock index 7fdae6d..bed4b17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,6 +61,7 @@ dependencies = [ "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.67 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b9b4c8d..ebde78d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ edition = "2018" [dependencies] ansi_term = "0.12" atty = "0.2" +libc = "0.2" [dependencies.clap] version = "2" diff --git a/src/input.rs b/src/input.rs index fd54d14..9d8268d 100644 --- a/src/input.rs +++ b/src/input.rs @@ -20,14 +20,14 @@ impl<'a> Seek for Input<'a> { match *self { Input::File(ref mut file) => { let seek_res = file.seek(pos); - if let Err(Some(29)) = seek_res.as_ref().map_err(|err| err.raw_os_error()) { + if let Err(Some(libc::ESPIPE)) = seek_res.as_ref().map_err(|err| err.raw_os_error()) + { return Err(io::Error::new( io::ErrorKind::Other, "Using '--seek' is not supported when using a pipe", ) .into()); }; - dbg!(&seek_res); seek_res } Input::Stdin(_) => Err(io::Error::new(