diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 2e3b8cb896f..f164e86554b 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -36,7 +36,7 @@ jiff = { workspace = true, optional = true, features = [ "tzdb-concatenated", ] } rustc-hash = { workspace = true } -rustix = { workspace = true, features = ["fs", "pipe", "process"] } +rustix = { workspace = true, features = ["fs", "net", "pipe", "process"] } time = { workspace = true, optional = true, features = [ "formatting", "local-offset", diff --git a/tests/by-util/test_tr.rs b/tests/by-util/test_tr.rs index 0d460c97717..bfb490a56a5 100644 --- a/tests/by-util/test_tr.rs +++ b/tests/by-util/test_tr.rs @@ -1649,20 +1649,19 @@ fn test_broken_pipe_no_error() { .fails_silently(); } -#[cfg(not(windows))] +#[cfg(unix)] #[test] fn test_stdin_is_socket() { - use nix::sys::socket::{AddressFamily, SockFlag, SockType, socketpair}; - use nix::unistd::write; + use std::io::Write as _; - let (fd1, fd2) = socketpair( - AddressFamily::Unix, - SockType::Stream, + let (fd1, fd2) = rustix::net::socketpair( + rustix::net::AddressFamily::UNIX, + rustix::net::SocketType::STREAM, + rustix::net::SocketFlags::empty(), None, - SockFlag::empty(), ) .unwrap(); - write(fd1, b"::").unwrap(); + std::fs::File::from(fd1).write_all(b"::").unwrap(); new_ucmd!() .args(&[":", ";"]) .set_stdin(fd2)