[PATCH] rustbuild: fix bad usage of UNIX exec() in rustc wrapper
authorXimin Luo <infinity0@pwned.gg>
Mon, 27 Jul 2020 01:42:02 +0000 (02:42 +0100)
committerXimin Luo <infinity0@debian.org>
Thu, 6 Aug 2020 20:11:39 +0000 (21:11 +0100)
exec never returns, it replaces the current process. so anything after it is
unreachable. that's not how exec_cmd() is used in the surrounding code

Gbp-Pq: Name u-fix-exec.patch

src/bootstrap/bin/rustc.rs

index 047957e225e8b2f1cc759da45ead04040fe835cd..a95e4e03631312b29f872fe3fe9e49e427238211 100644 (file)
@@ -220,13 +220,6 @@ fn main() {
     std::process::exit(code);
 }
 
-#[cfg(unix)]
-fn exec_cmd(cmd: &mut Command) -> io::Result<i32> {
-    use std::os::unix::process::CommandExt;
-    Err(cmd.exec())
-}
-
-#[cfg(not(unix))]
 fn exec_cmd(cmd: &mut Command) -> io::Result<i32> {
     cmd.status().map(|status| status.code().unwrap())
 }