Skip to content

Commit a2fd722

Browse files
committed
fix(wc): flush stdout before printing deferred error
Ensure deferred error messages are printed after all stats output, matching GNU wc behavior. Added io::stdout().flush() to guarantee buffered output is written before showing the error.
1 parent e9070a9 commit a2fd722

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/uu/wc/src/wc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ fn wc(inputs: &Inputs, settings: &Settings) -> UResult<()> {
973973
}
974974
// Print deferred error after stats to match GNU wc output order
975975
if let Some(err) = deferred_error {
976+
let _ = io::stdout().flush();
976977
show!(err);
977978
}
978979
}

0 commit comments

Comments
 (0)