Skip to content

Fix large piped output hanging and duplicating bytes - #10

Merged
kklimuk merged 1 commit into
mainfrom
fix/issue-8-piped-output
Sep 25, 2026
Merged

kklimuk merged 1 commit into
mainfrom
fix/issue-8-piped-output

Conversation

@kklimuk

@kklimuk kklimuk commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #8.

Large piped output can hang and repeat its first 64 KiB after a dependency accesses process.stdout. Use lazy Bun FileSinks for stdout and stderr, awaiting each write and flush before the CLI exits. Text/JSON output and the in-process capture API stay compatible.

Add bounded real-pipe regressions for backpressure, UTF-8 byte integrity, sequential writes, immediate exit, restored capture, and early consumer closure. Exercise full CLI Markdown/AST output and run the output contract on macOS with Bun 1.3.10 and latest. Update the output guidance and CI documentation.

Test plan

  • bun run check (lint, types, dead code).
  • 87 output-contract tests pass on macOS ARM64 with Bun 1.3.10 and installed Bun 1.4.1-canary.1.
  • Source, npm bundle, and standalone executable: large Markdown, AST, and raw XML output matches file redirection byte-for-byte through real pipes; help/version, stderr, errors, mutation acknowledgments, and terminal output checked.
  • Bun 1.3.10-built bundle and standalone executable pass large-output and document-operation smoke checks.
  • Adversarial security, correctness, and product review; findings addressed.

No LibreOffice checks were run during final review. Native Windows/Linux execution and the new GitHub CI jobs have not been run locally. The pre-commit full-suite hook was skipped to avoid launching LibreOffice; the checks above were run separately.

@kklimuk
kklimuk merged commit bb55d8f into main Sep 25, 2026
6 checks passed
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.

Piped stdout over 64 KiB hangs at 100% CPU and re-sends bytes from offset 0

1 participant