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

Handle better some errors #5791

Merged
merged 4 commits into from
Jan 15, 2024
Merged

Handle better some errors #5791

merged 4 commits into from
Jan 15, 2024

Conversation

sylvestre
Copy link
Sponsor Contributor

for these two fixes, it was breaking some Rust errors
tested in tests/misc/read-errors.sh

@cakebaker
Copy link
Contributor

Fails on Windows:

thread 'test_basenc::test_invalid_input' panicked at tests\by-util\test_basenc.rs:27:10:
assertion failed: `(left == right)`

Diff < left / right > :
<basenc: .: Permission denied
>basenc: error: invalid input

Comment on lines +83 to +87
Err(e) => {
set_exit_code(1);
show_error!("error reading input: {}", e);
return Ok(());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very similar to what UIoError does, but this is also quite clear, so it's fine.

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how to do that with the Ok? do you we have other examples ?

tests/by-util/test_expand.rs Outdated Show resolved Hide resolved

#[test]
fn fails_on_directory() {
new_ucmd!().arg("<").arg(".").fails();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails as it should, but not for the reason you're expecting. The < will not pipe here. It will be an argument to factor, so factor '<' '.'.

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ah, fun :)

@cakebaker cakebaker merged commit 112eb21 into uutils:main Jan 15, 2024
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants