-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Broken pipe error when piping "s3 ls" output to grep -q #5899
Comments
Debug shows this:
|
I get an exit code of 120, not 255. |
Looks like we would need to do this to resolve this: https://docs.python.org/3/library/signal.html#note-on-sigpipe |
Fixed this in PR #6303, please review :) |
Activelly cc'ing @kdaily as this thread is a bit slow paced and somewhat quiet |
Hi @bcap, Thanks for the PR, marking this issue to be reviewed. |
does the same currently im buffering it via a tmp file
but I'm sure this is a more elegant way |
I'm seeing the same behaviour piping to aws s3 ls s3://my-bucket/ | grep -m 10 -e 'regex' I assume the pipe is broken because I don't know enough about Linux programming in Python to know how to fix it, but I think buffering it through a temp file is probably the simplest fix! |
Got a similar issue with also exit code = 120. Unable to find an explanation. |
My platform differs from the OP but the result seems to be the same. This works:
If I add
If there's no match, the command exits normally with code 1 as expected. My shell is zsh 5.9 and
|
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
[Errno 32] Broken pipe
is raised whenaws s3 ls
output is piped togrep -q
and the matching string is found; exit code is 255.SDK version number
aws-cli/1.18.220 Python/2.7.17 botocore/1.19.60
Platform/OS/Hardware/Device
Linux/4.15.0-134-generic x86_64, Ubuntu 18.04.5 LTS
To Reproduce (observed behavior)
Steps to reproduce the behavior
Expected behavior
No failure, just a clean exit with code 0.
Additional context
Command
grep -q
will stop immediately after the first match, and the program which is writing to the pipe will receive SIGPIPE. It is clear, that in case ofs3 ls
this signal can be ignored.The text was updated successfully, but these errors were encountered: