mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-07-26 01:31:57 -07:00
core: lock stdout before printing an error message to stderr
Adds a new eprintln_locked macro which locks STDOUT before logging to STDERR. This patch also replaces instances of eprintln with eprintln_locked to avoid interleaving lines. Fixes #1941, Closes #1968
This commit is contained in:
committed by
Andrew Gallant
parent
4993d29a16
commit
4782ebd5e0
@@ -47,7 +47,7 @@ type Result<T> = ::std::result::Result<T, Box<dyn error::Error>>;
|
||||
|
||||
fn main() {
|
||||
if let Err(err) = Args::parse().and_then(try_main) {
|
||||
eprintln!("{}", err);
|
||||
eprintln_locked!("{}", err);
|
||||
process::exit(2);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user