Flush stdout before writing to stderr.

In particular, terminal.reset() doesn't flush, so it ensures that stderr isn't
unintentionally printed in the color of the preceding line.
This commit is contained in:
Dan Gohman
2017-09-12 16:35:45 -07:00
parent c7bd842ee3
commit f5639a66e6

View File

@@ -98,6 +98,7 @@ fn main() {
if !msg.ends_with('\n') {
msg.push('\n');
}
io::stdout().flush().expect("flushing stdout");
io::stderr().write_all(msg.as_bytes()).unwrap();
process::exit(1);
}