Skip to content

Fix non-deterministic stdout and stderr interleaving - #38

Open
finn-episub wants to merge 2 commits into
saward:mainfrom
finn-episub:main
Open

Fix non-deterministic stdout and stderr interleaving#38
finn-episub wants to merge 2 commits into
saward:mainfrom
finn-episub:main

Conversation

@finn-episub

@finn-episubfinn-episub commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Description

When not outputting to a tty postgres uses block buffering for stdout but stderr is unbuffered. This creates a race condition where merging stdout and stderr can produce different ordering when the streams are merged. This PR splits them into two separate outputs and compares then separately.

Another option that was considered was allocating a pty rather than a pipe but that would have been more complicated and required some windows specific code and testing.

Checklist

  • I have read the CONTRIBUTING.md guide.
  • I confirm that I have read and signed the Contributor License Agreement linked below.
  • My contribution is original and I have the right to submit it.
  • I have listed any third-party code or licences in this PR description.
  • Unit tests are included.
  • I have looked over this PR first before asking for reviews.

finn-episuband others added 2 commits August 18, 2026 13:24
Covers the split-stream stderr diff path with a real fixture (a NOTICE
from DROP TABLE IF EXISTS) instead of only exercising it manually, and
adds a test confirming a stderr-only regression is caught even when
stdout is unchanged.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for freeto 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

@finn-episub