Skip to content

refactor: add TeeState enum#12423

Closed
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:tee-result
Closed

refactor: add TeeState enum#12423
xtqqczze wants to merge 1 commit into
uutils:mainfrom
xtqqczze:tee-result

Conversation

@xtqqczze
Copy link
Copy Markdown
Contributor

@xtqqczze xtqqczze commented May 21, 2026

Context: #12419

Previously, pipes::tee returned a rustix::io::Result, which does not align with the intended abstraction boundary. Since the Err variant was always discarded at the call sites, the implementation can be simplified by using an enum instead.

@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 21, 2026

We use Ok(()) and Err(()) only. No benefit by your change.
@xtqqczze Please stop changing splice code soon.

Comment thread src/uu/yes/src/yes.rs
if safe_partial_send && tee(&p_read, &stdout, MAX_ROOTLESS_PIPE_SIZE).is_ok() {
while let Ok(1..) = tee(&p_read, &stdout, MAX_ROOTLESS_PIPE_SIZE) {}
if safe_partial_send {
while let TeeState::Ended(_) = tee(&p_read, &stdout, MAX_ROOTLESS_PIPE_SIZE) {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want do same things for all of standard read & write loop?!

@oech3

This comment was marked as resolved.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)

@xtqqczze xtqqczze marked this pull request as draft May 21, 2026 14:40
@xtqqczze xtqqczze closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants