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 BrokenPipe gracefully #60

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Handle BrokenPipe gracefully #60

merged 1 commit into from
Aug 22, 2023

Conversation

jobarr-amzn
Copy link
Contributor

Description of changes:

Without this, using ion-cli in a pipeline which truncates the output can result in unwanted error output to stderr, e.g.:

❯ ion dump foo.ion | grep "^  timestamp" | cut -w -f 3 | cut -c 2-20 | head -2
2023-07-31T23:11:36
2023-07-31T23:11:36
Error: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }

Caused by:
    Broken pipe (os error 32)

By handling BrokenPipe gracefully (i.e. ignoring it), we instead see:

❯ ion dump foo.ion | grep "^  timestamp" | cut -w -f 3 | cut -c 2-20 | head -2
2023-07-31T23:11:36
2023-07-31T23:11:36

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@popematt popematt left a comment

Choose a reason for hiding this comment

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

This is a nice fix. Thanks!

@jobarr-amzn jobarr-amzn merged commit 2f1fa56 into master Aug 22, 2023
7 checks passed
@jobarr-amzn jobarr-amzn deleted the broken-pipe branch August 22, 2023 22:20
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.

2 participants