diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 82cd3647040..e733766741d 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -2161,7 +2161,9 @@ impl Termination for ! { impl Termination for Result { fn report(self) -> ExitCode { let Err(err) = self; - eprintln!("Error: {err:?}"); + // Ignore error if the write fails, for example because stderr is + // already closed. There is not much point panicking at this point. + let _ = writeln!(io::stderr(), "Error: {err:?}"); ExitCode::FAILURE } }