Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: single files will not cause IO error (#194) #195

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn extract_paths_maybe_set_cwd(
mut paths: Vec<PathBuf>,
cross_filesystems: bool,
) -> Result<Vec<PathBuf>, io::Error> {
if paths.len() == 1 {
if paths.len() == 1 && paths[0].is_dir() {
std::env::set_current_dir(&paths[0])?;
paths.clear();
}
Expand Down
1 change: 1 addition & 0 deletions tests/snapshots/success-single-file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
 4.10 KB a
6 changes: 6 additions & 0 deletions tests/stateless-journey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ WITH_FAILURE=1
expect_run ${SUCCESSFULLY} "$exe" aggregate
}
)
(with "a single file argument"
it "produces a human-readable (metric) size display of that file" && {
WITH_SNAPSHOT="$snapshot/success-single-file" \
expect_run ${SUCCESSFULLY} "$exe" aggregate a
}
)
(with "sorting disabled"
it "produces a human-readable (metric) aggregate of everything within the current directory, alphabetically sorted, with total" && {
WITH_SNAPSHOT="$snapshot/success-no-arguments-no-sort" \
Expand Down
Loading