about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-10 09:28:20 -0700
committerGitHub <noreply@github.com>2022-08-10 09:28:20 -0700
commitf0fdc464be76cd589ff3981796d398d8a73c5d6f (patch)
tree39e0c36024a7da425279684e12a07c9259203e21
parenteae824d5bb576a5bddd79e0d9a0de8cbcfcbb3f6 (diff)
parent0d8bcc3dc5c2b9bbe19a65b82e4391bd07d52dff (diff)
downloadrust-f0fdc464be76cd589ff3981796d398d8a73c5d6f.tar.gz
rust-f0fdc464be76cd589ff3981796d398d8a73c5d6f.zip
Rollup merge of #100339 - shourya5:issue#100258, r=jyn514
Fixes bootstrap panic when running x fmt --check

closes #100258 wherein bootstrap panics when running x fmt --check. Fixed by replacing resume_unwind  in #98994. with process::exit.
-rw-r--r--src/bootstrap/lib.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index f84de73297a..a242243aaaf 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1631,14 +1631,12 @@ fn chmod(_path: &Path, _perms: u32) {}
 /// If code is not 0 (successful exit status), exit status is 101 (rust's default error code.)
 /// If the test is running and code is an error code, it will cause a panic.
 fn detail_exit(code: i32) -> ! {
-    // Successful exit
-    if code == 0 {
-        std::process::exit(0);
-    }
-    if cfg!(test) {
+    // if in test and code is an error code, panic with staus code provided
+    if cfg!(test) && code != 0 {
         panic!("status code: {}", code);
     } else {
-        std::panic::resume_unwind(Box::new(code));
+        //otherwise,exit with provided status code
+        std::process::exit(code);
     }
 }