Skip to content

fix: propagate upstream errors during async iteration - #197

Open
VIOLETee0 wants to merge 1 commit into
tinylibs:mainfrom
VIOLETee0:fix/stream-pipeline-upstream-errors
Open

VIOLETee0 wants to merge 1 commit into
tinylibs:mainfrom
VIOLETee0:fix/stream-pipeline-upstream-errors

Conversation

@VIOLETee0

Copy link
Copy Markdown

Streaming a pipeline can hide a failed upstream command. With the source using throwOnError: true, a source exit code of 7 and a successful destination, await destination throws the source's NonZeroExitError, but for await (const line of destination) completes normally.

Await the stdin process after streaming the destination, as the existing buffered path does. The regression uses real Node subprocesses and checks both throwOnError values: output is preserved, the enabled case reports the original source error, and the disabled case still completes normally.

Validation on Windows, Node 24.20.0:

  • New regression: fails on the unmodified implementation, passes with the fix (2 cases).
  • Built-package reproduction: both buffered and streaming consumption now report the source error; the destination still exits successfully.
  • Build, format check, typecheck, ESLint, publint and the existing smoke test passed.
  • Full unit suite: 75 passed, 5 failed, 1 skipped. The five failures expect English Windows command-not-found messages; this machine emits localized Chinese messages. Rerunning with the unmodified source confirms those same five failures, plus the new regression failure. No existing test gained a failure.

Other Node versions, Linux and Bun were not run locally. No options, defaults or dependencies change.

AI assistance: Codex investigated the inconsistency, prepared the patch and ran the checks above.

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