Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/uu/tee/src/tee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
const BUF_SIZE: usize = 32 * 1024;
#[cfg(all(unix, not(target_os = "fuchsia")))]
if uucore::signals::stdin_was_closed() {
let e = Error::from(rustix::io::Errno::BADF);

Check warning on line 152 in src/uu/tee/src/tee.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

WARNING: `cspell`: Unknown word 'BADF' (file:'src/uu/tee/src/tee.rs', line:152)
show_error!(
"{}",
translate!("tee-error-stdin", "error" => strip_errno(&e))
Expand All @@ -160,10 +160,14 @@
let input = rustix::stdio::stdin();
#[cfg(not(any(unix, target_os = "wasi")))]
let mut input = io::stdin();
// needs 2 pipes to duplicate input multiple times
// freeze by max size since system allocates pipe smaller than default size when user has pages more than fs.pipe-user-pages-soft
#[cfg(any(target_os = "linux", target_os = "android"))]
if let Ok((mut pipe_read, mut pipe_write)) = uucore::pipes::pipe::<true>()
// use splice fast-path only for non-file input since page caches can be changed during copy.
// If input is a stream coming from file, it should be provider command's responsibility.
// todo: for input as a file, we can own pages replacing a pipe with memfd which is still faster than read/write.
if rustix::fs::fadvise(input, 0, None, rustix::fs::Advice::Sequential).is_err()
// needs 2 pipes to duplicate input multiple times
// freeze size since system allocates pipes with different size when fs.pipe-user-pages-soft was changed between generating them.
&& let Ok((mut pipe_read, mut pipe_write)) = uucore::pipes::pipe::<true>()
Comment thread
oech3 marked this conversation as resolved.
&& let Ok((mut pipe2_read, mut pipe2_write)) = uucore::pipes::pipe::<true>()
{
use uucore::pipes::MAX_ROOTLESS_PIPE_SIZE;
Expand Down
Loading