diff --git a/CHANGELOG.md b/CHANGELOG.md index 0efa768..a1fc87c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - ReleaseDate +#### Bug Fixes + +- Fix crash when processing stdin (`-`) + ## [1.0.2] - 2021-05-28 #### Bug Fixes diff --git a/Cargo.lock b/Cargo.lock index e0fc50a..61e6368 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,6 +56,20 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "assert_cmd" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f57fec1ac7e4de72dcc69811795f1a7172ed06012f80a5d1ee651b62484f588" +dependencies = [ + "bstr", + "doc-comment", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + [[package]] name = "assert_fs" version = "1.0.2" @@ -1475,6 +1489,7 @@ version = "1.0.2" dependencies = [ "ahash", "anyhow", + "assert_cmd", "assert_fs", "atty", "bstr", @@ -1647,6 +1662,15 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.3.2" diff --git a/Cargo.toml b/Cargo.toml index 98bc433..2e36fa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,6 +83,7 @@ typed-arena = "2.0.1" [dev-dependencies] assert_fs = "1.0" +assert_cmd = "1.0" predicates = "1.0" criterion = "0.3" maplit = "1.0" diff --git a/src/file.rs b/src/file.rs index 54157f9..ba482c6 100644 --- a/src/file.rs +++ b/src/file.rs @@ -600,7 +600,7 @@ fn walk_entry( let explicit = entry.depth() == 0; let (path, lookup_path) = if entry.is_stdin() { let path = std::path::Path::new("-"); - (path, path.to_owned()) + (path, std::env::current_dir()?) } else { let path = entry.path(); (path, path.canonicalize()?)