Exit quietly on broken pipe in auxiliary output paths
The main output path has exited with status 0 on EPIPE since #232, but auxiliary outputs still used println!/print!/io::stdout().flush().unwrap() and panicked (exit code 101) when the reader of a piped stdout went away early, e.g. 'bat --completion bash | head -n0'. Route them through the existing convention instead: write!/writeln! to io::stdout() and '?' so that Error::Io(BrokenPipe) reaches default_error_handler, which exits with status 0. This covers --completion, --config-file, --diagnostic (bugreport's print() becomes format() + writeln!), --generate-config-file, the 'cache' subcommand progress messages, the OSC title sequence of --set-terminal-title, and the 'built without feature' notices. Closes #4034
This commit is contained in:
1 parent
4608fc959a
commit
a9b112b6fe
6 files changed
+133
-50
No files matched your search
@@ -25,6 +25,7 @@
|
||||
- Syntax highlighting for Python files using uv as script runner in shebang #3689 (@janlarres)
|
||||
|
||||
## Bugfixes
|
||||
- Exit quietly with status 0 instead of panicking when stdout is closed early (broken pipe) on auxiliary output paths such as `--completion`, `--config-file`, `--diagnostic`, `--generate-config-file`, `--set-terminal-title` and `cache --build`/`--clear`, matching the main output path since #232. Closes #4034 (@Mathjk)
|
||||
- Track strikethrough (SGR 9 / 29) in the ANSI style tracker so it is re-emitted like bold, dim, italic, and underline, and is no longer dropped after the first highlighted token when displaying ANSI input with syntax highlighting, see #4015 (@mikehasa)
|
||||
- Allow boolean flags to be given more than once, so that a flag set in the config file can also be passed on the command line without erroring, see #3912 (@logarithmone1128)
|
||||
- Use parsed CLI arguments to detect number flags, see #3908 (@cuishuang)
|
||||
|
||||
Reference in new issue
Block a user