about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/std/src/process.rs4
1 files changed, 3 insertions, 1 deletions
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<E: fmt::Debug> Termination for Result<!, E> {
     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
     }
 }