File tree Expand file tree Collapse file tree
src/uucore/src/lib/features Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,18 +11,20 @@ use rustix::pipe::{SpliceFlags, fcntl_setpipe_size};
1111use std:: fs:: File ;
1212#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1313use std:: os:: fd:: AsFd ;
14+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1415pub 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 ) ) ]
2324pub 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) ) )
You can’t perform that action at this time.
0 commit comments