Merge pull request #265 from epage/redirect

fix(cli): Don't crash on stdin
This commit is contained in:
Ed Page 2021-05-28 19:33:50 -05:00 committed by GitHub
commit bb4b3dad88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 1 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased] - ReleaseDate
#### Bug Fixes
- Fix crash when processing stdin (`-`)
## [1.0.2] - 2021-05-28
#### Bug Fixes

24
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -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()?)