diff --git a/Cargo.toml b/Cargo.toml index 5cc8c679a10..c6d470a2f52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ im-rc = "15.0.0" indexmap = "1" is-terminal = "0.4.4" itertools = "0.10.0" -jobserver = "0.1.24" +jobserver = "0.1.26" lazy_static = "1.2.0" lazycell = "1.2.0" libc = "0.2" diff --git a/crates/cargo-util/Cargo.toml b/crates/cargo-util/Cargo.toml index 7c9d89df12a..aa25c137640 100644 --- a/crates/cargo-util/Cargo.toml +++ b/crates/cargo-util/Cargo.toml @@ -12,7 +12,7 @@ anyhow = "1.0.34" crypto-hash = "0.3.1" filetime = "0.2.9" hex = "0.4.2" -jobserver = "0.1.21" +jobserver = "0.1.26" libc = "0.2.88" log = "0.4.6" same-file = "1.0.6" diff --git a/tests/testsuite/jobserver.rs b/tests/testsuite/jobserver.rs index c645e0d7226..9ccff141e1e 100644 --- a/tests/testsuite/jobserver.rs +++ b/tests/testsuite/jobserver.rs @@ -22,20 +22,24 @@ fn main() { #[cfg(unix)] fn validate(s: &str) { - use std::fs::File; + use std::fs::{self, File}; use std::io::*; use std::os::unix::prelude::*; - let fds = s.split(',').collect::>(); - println!("{}", s); - assert_eq!(fds.len(), 2); - unsafe { - let mut read = File::from_raw_fd(fds[0].parse().unwrap()); - let mut write = File::from_raw_fd(fds[1].parse().unwrap()); + if let Some((r, w)) = s.split_once(',') { + // `--jobserver-auth=R,W` + unsafe { + let mut read = File::from_raw_fd(r.parse().unwrap()); + let mut write = File::from_raw_fd(w.parse().unwrap()); - let mut buf = [0]; - assert_eq!(read.read(&mut buf).unwrap(), 1); - assert_eq!(write.write(&buf).unwrap(), 1); + let mut buf = [0]; + assert_eq!(read.read(&mut buf).unwrap(), 1); + assert_eq!(write.write(&buf).unwrap(), 1); + } + } else { + // `--jobserver-auth=fifo:PATH` is the default since GNU Make 4.4 + let (_, path) = s.split_once(':').expect("fifo:PATH"); + assert!(fs::metadata(path).unwrap().file_type().is_fifo()); } }