Skip to content

Commit f16024b

Browse files
committed
Put pipecheck in the BufWriter, not the other way around
EPIPE can only happen on writes to the real stderr, so checking for those failures on every _buffered_ write is silly. This is also my justification for not cargo-culting `#[cold]` or other silly "performance" attributes on pipecheck's termination functions. This only matters when you're making a system call, at which point you're doing something far more expensive than a branch misprediction or whatever.
1 parent bc833ff commit f16024b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn main() {
5959
}
6060

6161
let mut stdin_used = false;
62-
let mut output = pipecheck::wrap(BufWriter::new(stdout.lock()));
62+
let mut output = BufWriter::new(pipecheck::wrap(stdout.lock()));
6363
let mut translator = xt::Translator::new(&mut output, args.to);
6464

6565
let input_paths = if args.input_pathnames.is_empty() {

0 commit comments

Comments
 (0)