Skip to content

fix: wait for print output flush in bootstrap branch (stdin inherit + -p) - #251

Merged
bash0816 merged 1 commit into
mainfrom
fix/claude-stdin-print-wait
Jul 28, 2026
Merged

fix: wait for print output flush in bootstrap branch (stdin inherit + -p)#251
bash0816 merged 1 commit into
mainfrom
fix/claude-stdin-print-wait

Conversation

@bash0816

Copy link
Copy Markdown
Owner

Private issue #18 (bash0816/CluadeCode-Termux-private) の修正。G1(11回)・G2(6回)ともにGPT-5.6-terraからGo判定取得済み。詳細はコミットメッセージ参照。

Summary

  • Bootstrap branch が stdin inherit と -p フラグ使用時に出力フラッシュを待たない問題を修正
  • Helper branch と同じ flush wait ロジックを bootstrap にも追加
  • 同期的 process.exit() (RequestedExit) パスにも wait を追加

Verification

  • Static containment tests: 関数宣言と呼び出しの存在を検証
  • Runtime regression tests: normal/sync-exit/async-exit シナリオを検証
  • Manual test: env CLAUDE_TERMUX_STDIN=inherit claude -p での exit code/output を確認

… -p)

Fixes silent exit 0 with 0-byte stdout/stderr when piping a prompt via
stdin with CLAUDE_TERMUX_STDIN=inherit. The bootstrap branch lacked the
output-flush wait that the helper branch already has, and the wait was
missing from the synchronous process.exit() (RequestedExit) path in both
branches.

- Export CLAUDE_TERMUX_PRINT_MODE in shell before invoking bootstrap
- Define waitForPrintFlush in helper branch outside try block for catch access
- Define waitForPrintFlushIfNeeded in bootstrap branch outside try block
- Call these functions after main execution and in RequestedExit handlers
- Add static containment tests to verify presence of fix
- Add runtime regression tests for normal/sync-exit/async-exit scenarios

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@bash0816
bash0816 merged commit 02b2b28 into main Jul 28, 2026
4 checks passed
@bash0816
bash0816 deleted the fix/claude-stdin-print-wait branch July 28, 2026 22:40
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