From d7da67d029a6fe07c6d7f52b381a934002d6eae8 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Sun, 5 Apr 2026 22:47:06 +0900 Subject: [PATCH] gate uucore::pipes::pipe to test --- src/uucore/src/lib/features/pipes.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uucore/src/lib/features/pipes.rs b/src/uucore/src/lib/features/pipes.rs index c4fc19b2123..cb96908aad9 100644 --- a/src/uucore/src/lib/features/pipes.rs +++ b/src/uucore/src/lib/features/pipes.rs @@ -11,18 +11,20 @@ use rustix::pipe::{SpliceFlags, fcntl_setpipe_size}; use std::fs::File; #[cfg(any(target_os = "linux", target_os = "android"))] use std::os::fd::AsFd; +#[cfg(any(target_os = "linux", target_os = "android"))] pub const MAX_ROOTLESS_PIPE_SIZE: usize = 1024 * 1024; /// A wrapper around [`rustix::pipe::pipe`] that ensures the pipe is cleaned up. /// /// Returns two `File` objects: everything written to the second can be read /// from the first. -/// This is used only for resolving the limitation for splice: one of a input or output should be pipe +/// used for resolving the limitation for splice: one of a input or output should be pipe #[inline] -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", test))] pub fn pipe() -> std::io::Result<(File, File)> { let (read, write) = rustix::pipe::pipe()?; // improve performance for splice + #[cfg(any(target_os = "linux", target_os = "android"))] let _ = fcntl_setpipe_size(&read, MAX_ROOTLESS_PIPE_SIZE); Ok((File::from(read), File::from(write)))