Skip to content

fix(pipeline): honor read -t deadline against delayed subshell producers - #1291

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/1206-read-timeout-pipe
Oct 23, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/1206-read-timeout-pipe

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Fixes #1206

Summary

  • (sleep 2; echo late) | { read -t 1 x; } waited ~2s for the producer and consumed late with rc=0; (sleep 3) | { read -t 1; } returned rc=1 only when the pipe closed.
  • The timed-read fast path (execute_timed_read_pipeline) models producer timing, but only walked { ...; } brace-group bodies — a ( ... ) subshell producer declined and fell back to the sequential stage loop where the deadline armed after data had already arrived. timed_pipeline_input now walks subshell_command bodies the same way.

Before: rc=0 x=[late] / rc=1 y=[]

After: rc=142 x=[] / rc=142 y=[] (matches GNU 5.3.20; read returns at ~1s, not the producer's ~3s)

Test plan

  • tests/issue1206_read_timeout_pipe.rs (4 cases vs WSL GNU Bash 5.3.20)
  • cargo fmt clean

Generated with Devin

…rubash#1206)

`(sleep 2; echo late) | { read -t 1 x; }` waited out the producer and
consumed the late line with status 0 — the -t deadline never applied to
pipe input. execute_timed_read_pipeline already models producer timing
for `{ ...; }` bodies; a `( ... )` subshell producer declined the fast
path and fell back to the sequential stage loop where the deadline was
armed after the data had arrived. Walk subshell_command bodies the same
way so an expired deadline reports 128+SIGALRM (142).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@caomengxuan666
caomengxuan666 merged commit ad6ef75 into master Oct 23, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/1206-read-timeout-pipe branch October 23, 2026 08:54
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.

[bug] read -t timeout ignored when stdin is a pipe (waits for data; EOF gives rc=1 not 142)

1 participant