Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support inheriting jobserver fd for external subcommands
If cargo detects the existence of a jobserver, cargo should pass the jobserver down to the external subcommand. Here are the reasons: 1. The existence of jobserver implies the user "expects" the amount of job is under control. However, before this commit, external subcommands cannnot benefit from the global view of the jobserver. 2. `cargo-clippy` as an external subcommand migth also love to respect the jobserver protocol. 3. There are several well-known external subcommands calling "cargo" interally (cargo-fuzz, cargo-tarpaulin, etc.) Caveats: Job without special prefix `+` might still be considered as a sub-make and would inherit the jobserver, though I don't see it as an issue. According to GNU Make Manual "13.1.1 POSIX Jobserver Interaction" [^1], if `--jobserver-auth` option is available in `MAKEFLAGS` but the file descriptors are closed, it means that the calling `make` didn't consider our tool awas a recursive `make` invocation. I make an assumption that if those fds are still open, we are happy to use those jobserver tokens. [^1]: https://www.gnu.org/software/make/manual/make.html#POSIX-Jobserver
- Loading branch information