diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index e6e41c5226f..c0e8f395867 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -185,6 +185,12 @@ impl TargetInfo { .args(&rustflags) .env_remove("RUSTC_LOG"); + // Removes `FD_CLOEXEC` set by `jobserver::Client` to pass jobserver + // as environment variables specify. + if let Some(client) = config.jobserver_from_env() { + process.inherit_jobserver(client); + } + if let CompileKind::Target(target) = kind { process.arg("--target").arg(target.rustc_target()); }