Skip to content

Handle better some errors#5791

Merged
cakebaker merged 4 commits intouutils:mainfrom
sylvestre:handle-error
Jan 15, 2024
Merged

Handle better some errors#5791
cakebaker merged 4 commits intouutils:mainfrom
sylvestre:handle-error

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

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

@cakebaker
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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
Copy Markdown
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 ?


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

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
Copy Markdown
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 :)

@uutils uutils deleted a comment from github-actions bot Jan 8, 2024
@cakebaker cakebaker merged commit 112eb21 into uutils:main Jan 15, 2024
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