Skip to content

Commit

Permalink
Lock stderr in panic handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 9, 2024
1 parent a655e64 commit 288380d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,9 @@ pub fn install_ice_hook(
panic::update_hook(Box::new(
move |default_hook: &(dyn Fn(&PanicInfo<'_>) + Send + Sync + 'static),
info: &PanicInfo<'_>| {
// Lock stderr to prevent interleaving of concurrent panics.
let _guard = io::stderr().lock();

// If the error was caused by a broken pipe then this is not a bug.
// Write the error and return immediately. See #98700.
#[cfg(windows)]
Expand Down

0 comments on commit 288380d

Please sign in to comment.