Skip to content

Commit d7da67d

Browse files
committed
gate uucore::pipes::pipe to test
1 parent c5cff82 commit d7da67d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/uucore/src/lib/features/pipes.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ use rustix::pipe::{SpliceFlags, fcntl_setpipe_size};
1111
use std::fs::File;
1212
#[cfg(any(target_os = "linux", target_os = "android"))]
1313
use std::os::fd::AsFd;
14+
#[cfg(any(target_os = "linux", target_os = "android"))]
1415
pub const MAX_ROOTLESS_PIPE_SIZE: usize = 1024 * 1024;
1516

1617
/// A wrapper around [`rustix::pipe::pipe`] that ensures the pipe is cleaned up.
1718
///
1819
/// Returns two `File` objects: everything written to the second can be read
1920
/// from the first.
20-
/// This is used only for resolving the limitation for splice: one of a input or output should be pipe
21+
/// used for resolving the limitation for splice: one of a input or output should be pipe
2122
#[inline]
22-
#[cfg(any(target_os = "linux", target_os = "android"))]
23+
#[cfg(any(target_os = "linux", target_os = "android", test))]
2324
pub fn pipe() -> std::io::Result<(File, File)> {
2425
let (read, write) = rustix::pipe::pipe()?;
2526
// improve performance for splice
27+
#[cfg(any(target_os = "linux", target_os = "android"))]
2628
let _ = fcntl_setpipe_size(&read, MAX_ROOTLESS_PIPE_SIZE);
2729

2830
Ok((File::from(read), File::from(write)))

0 commit comments

Comments
 (0)