Skip to content

Commit 57880c2

Browse files
committed
Auto merge of #12951 - belovdv:jobserver-preserver-fd, r=weihanglo
fix: preserve jobserver file descriptors on rustc invocation in `fix_exec_rustc` Similar to #12447 Command `cargo fix` invokes `cargo rustc`. It sends environment variable which points to closed file descriptors. This PR makes cargo compatible with rust-lang/rust#113730. It should be enough to have tests in rustc. It seems to be good to have more centralized way to pass jobserver.
2 parents 19a0404 + e84fd16 commit 57880c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cargo/ops/fix.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ pub fn fix_exec_rustc(config: &Config, lock_addr: &str) -> CargoResult<()> {
451451
// things like colored output to work correctly.
452452
rustc.arg(arg);
453453
}
454+
// Removes `FD_CLOEXEC` set by `jobserver::Client` to pass jobserver
455+
// as environment variables specify.
456+
if let Some(client) = config.jobserver_from_env() {
457+
rustc.inherit_jobserver(client);
458+
}
454459
debug!("calling rustc to display remaining diagnostics: {rustc}");
455460
exit_with(rustc.status()?);
456461
}

0 commit comments

Comments
 (0)