Skip to content

fix: restore TTY cleanup for stream interrupts#175

Open
luyua9 wants to merge 1 commit into
BuilderIO:mainfrom
luyua9:fix/stream-interrupt-tty-cleanup-luyua9
Open

fix: restore TTY cleanup for stream interrupts#175
luyua9 wants to merge 1 commit into
BuilderIO:mainfrom
luyua9:fix/stream-interrupt-tty-cleanup-luyua9

Conversation

@luyua9
Copy link
Copy Markdown

@luyua9 luyua9 commented May 19, 2026

Summary

Fix the streaming interrupt key path in readData():

  • register readline keypress events before listening for q / escape,
  • only enable raw mode when stdin is a TTY,
  • remove the keypress listener, restore raw mode, and close readline in finally when the stream exits.

Without readline.emitKeypressEvents(), the keypress listener is not reliably wired for raw stdin, so the documented stop keys can fail while the terminal is left in raw mode after early stream exit.

Validation

  • git diff --check
  • npm run typecheck -- --pretty false could not run in this clean checkout because dependencies are not installed (Cannot find module 'cleye', openai, @types/node, etc.).

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