mirror of
https://github.com/sharkdp/bat.git
synced 2026-10-12 02:22:28 +00:00
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