Skip to content

fix: end async iteration when output streams are disabled - #182

Open
dailyun wants to merge 1 commit into
tinylibs:mainfrom
dailyun:codex/finish-iteration-without-output-streams
Open

dailyun wants to merge 1 commit into
tinylibs:mainfrom
dailyun:codex/finish-iteration-without-output-streams

Conversation

@dailyun

@dailyun dailyun commented Oct 21, 2026

Copy link
Copy Markdown

Async iteration never finishes when neither stdout nor stderr is piped, even after the child exits. For example:

const proc = x(process.execPath, ['-e', ''], {
  nodeOptions: { stdio: 'ignore' }
});
for await (const line of proc) console.log(line);
console.log('finished'); // never reached before this fix

combineStreams([]) creates a stream that nobody ends. End it immediately when there are no inputs. The iterator still waits for the child to close, so throwOnError continues to report nonzero exits. This also fixes stdio: 'inherit' without changing output capture.

All four new regression cases time out on the previous code and pass with the fix. Full suite: 55 passed, 10 skipped on Node 24.19.0 and via the Bun 1.4.3 build/test command. Build, lint (including TypeScript and publint), and formatting pass.

Implemented and tested with Codex assistance.

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.

1 participant