Skip to content

Commit 0b04f5e

Browse files
authored
yes: fix wrong assumption for stdout (#12249)
1 parent 398b3d9 commit 0b04f5e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/uu/yes/src/yes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ pub fn exec(mut bytes: Vec<u8>) -> io::Result<()> {
119119
repeat_content_to_capacity(&mut bytes);
120120
let bytes = bytes.as_slice();
121121
let mut stdout = io::stdout(); // no need to lock with zero-copy
122+
// improve throughput
123+
let _ = rustix::pipe::fcntl_setpipe_size(&stdout, MAX_ROOTLESS_PIPE_SIZE);
122124
// don't show any error from fast-path and fallback to write for proper message
123125
if let Ok((p_read, mut p_write)) = pipe()
124-
// todo: zero-copy with default size when fcntl failed
125-
&& rustix::pipe::fcntl_setpipe_size(&stdout, MAX_ROOTLESS_PIPE_SIZE).is_ok()
126-
&& p_write.write_all(bytes).is_ok()
126+
&& p_write.write_all(bytes).is_ok()
127127
{
128128
if aligned && tee(&p_read, &stdout, MAX_ROOTLESS_PIPE_SIZE).is_ok() {
129129
while let Ok(1..) = tee(&p_read, &stdout, MAX_ROOTLESS_PIPE_SIZE) {}

0 commit comments

Comments
 (0)