Lock stderr in panic handler
This commit is contained in:
parent
a655e648a9
commit
288380d457
1 changed files with 3 additions and 0 deletions
|
@ -1317,6 +1317,9 @@ pub fn install_ice_hook(
|
||||||
panic::update_hook(Box::new(
|
panic::update_hook(Box::new(
|
||||||
move |default_hook: &(dyn Fn(&PanicInfo<'_>) + Send + Sync + 'static),
|
move |default_hook: &(dyn Fn(&PanicInfo<'_>) + Send + Sync + 'static),
|
||||||
info: &PanicInfo<'_>| {
|
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.
|
// If the error was caused by a broken pipe then this is not a bug.
|
||||||
// Write the error and return immediately. See #98700.
|
// Write the error and return immediately. See #98700.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue