Skip to content

Commit c088820

Browse files
committed
fix(fmt): Ensure stream gets flushed
Fixes #278
1 parent 2b3f26f commit c088820

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/fmt/writer/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,20 @@ impl WritableTarget {
6969
WritableTarget::WriteStdout => {
7070
let mut stream = std::io::stdout().lock();
7171
stream.write_all(buf)?;
72+
stream.flush()?;
7273
}
7374
WritableTarget::PrintStdout => print!("{}", String::from_utf8_lossy(buf)),
7475
WritableTarget::WriteStderr => {
7576
let mut stream = std::io::stderr().lock();
7677
stream.write_all(buf)?;
78+
stream.flush()?;
7779
}
7880
WritableTarget::PrintStderr => eprint!("{}", String::from_utf8_lossy(buf)),
7981
// Safety: If the target type is `Pipe`, `target_pipe` will always be non-empty.
8082
WritableTarget::Pipe(pipe) => {
8183
let mut stream = pipe.lock().unwrap();
8284
stream.write_all(buf)?;
85+
stream.flush()?;
8386
}
8487
}
8588

0 commit comments

Comments
 (0)