Compare commits

..
Author SHA1 Message Date
David Peter 73e79ebd07 Distinguish console writes from other writes 2026-10-02 11:12:03 +02:00
Mathjk 47339b0862 Handle broken pipe errors on stdout gracefully
Replace `println!` calls on the results paths with `writeln!` on
`io::stdout()` and propagate the `io::Error` to `main`, where
`ErrorKind::BrokenPipe` is turned into a quiet `exit(0)`. This matches
the conventional behavior of command-line tools when their output pipe
is closed early (e.g. `hyperfine ... | head -n 0`), and fixes panics in
all run-output paths: the per-benchmark header and results, the speed
comparison summary, and `-`-style exports to stdout. The warnings and
"Note" outputs to stderr are converted the same way.

The earlier fix for #453 only covered the `-h`/`--help` output. A
regression test runs hyperfine with a pre-closed stdout pipe.

Assisted-by: AI tooling (patch generated and verified automatically)
2026-10-02 11:09:38 +02:00
2 changed files with 1 additions and 2 deletions

No files matched your search

-1
View File
@@ -79,7 +79,6 @@ jobs:
matrix:
job:
- { target: aarch64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2022 }
+1 -1
View File
@@ -89,7 +89,7 @@ hyperfine -L compiler gcc,clang '{compiler} -O2 main.cpp'
### Intermediate shell
By default, commands are executed using `sh` on Unix (resolved through `PATH`) or `cmd.exe` on Windows.
By default, commands are executed using a predefined shell (`/bin/sh` on Unix, `cmd.exe` on Windows).
If you want to use a different shell, you can use the `-S, --shell <SHELL>` option:
```sh
hyperfine --shell zsh 'for i in {1..10000}; do echo test; done'