]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/lib.rs
Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillot
[rust.git] / src / bootstrap / lib.rs
index f84de73297acb066e0d0988d4fd0a610fbc1ad51..a242243aaafa91f38576b90f9466f54f1ee199d4 100644 (file)
@@ -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);
     }
 }