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:
@@ -98,6 +98,7 @@ fn main() {
|
|||||||
if !msg.ends_with('\n') {
|
if !msg.ends_with('\n') {
|
||||||
msg.push('\n');
|
msg.push('\n');
|
||||||
}
|
}
|
||||||
|
io::stdout().flush().expect("flushing stdout");
|
||||||
io::stderr().write_all(msg.as_bytes()).unwrap();
|
io::stderr().write_all(msg.as_bytes()).unwrap();
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user