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

hurfmt: panics when broken pipe #3661

Open
jcamiel opened this issue Jan 29, 2025 · 0 comments
Open

hurfmt: panics when broken pipe #3661

jcamiel opened this issue Jan 29, 2025 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Jan 29, 2025

hurlfmt is panicking when pipe is broken:

$ echo 'GET https://hurl.dev' | hurlfmt --out json | aaa
zsh: command not found: aaa
thread 'main' panicked at packages/hurlfmt/src/main.rs:138:18:
writing bytes to console: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Panicking is here =>

file.write_all(bytes.as_slice())
.expect("writing bytes to file");

Compare with Hurl:

$ echo 'GET https://hurl.dev' | hurl | aaa                     
zsh: command not found: aaa
error: IO Error
  --> -:1:1
   |
 1 | GET https://hurl.dev
   | ^ Broken pipe (os error 32)
   |

hurlfmt should exit with an error message and a status code != 0.

@jcamiel jcamiel added bug Something isn't working good first issue Good for newcomers labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant