1
Fork 0

Ensure diagnostics are printed in the correct order

Even when buffered. Ideally we would flush only when the emitter is
done, but that requires larger changes. This gives most of the benefit
of buffering in any case.
This commit is contained in:
Markus Westerlind 2020-02-17 16:46:51 +01:00
parent 7ac4154643
commit ee064befa0

View file

@ -104,7 +104,8 @@ impl Emitter for JsonEmitter {
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
} else {
writeln!(&mut self.dst, "{}", as_json(&data))
};
}
.and_then(|_| self.dst.flush());
if let Err(e) = result {
panic!("failed to print diagnostics: {:?}", e);
}
@ -116,7 +117,8 @@ impl Emitter for JsonEmitter {
writeln!(&mut self.dst, "{}", as_pretty_json(&data))
} else {
writeln!(&mut self.dst, "{}", as_json(&data))
};
}
.and_then(|_| self.dst.flush());
if let Err(e) = result {
panic!("failed to print notification: {:?}", e);
}