Skip to content

fix(input): stop Bun from dropping all input after a terminal query - #4

Closed
BlankParticle wants to merge 1 commit into
mainfrom
blank/bun-query-reattach
Closed

BlankParticle wants to merge 1 commit into
mainfrom
blank/bun-query-reattach

Conversation

@BlankParticle

Copy link
Copy Markdown
Member

Under Bun, input froze for good after the first terminal query, e.g. when a text field mounted in alchemy profile. Every keypress after that was lost.

The query ends by calling stdin.pause() inside its data callback, and handleQueryTerminal's finally then re-attaches the readable listener in the same tick. Node starts reading again for the new listener. Bun's TTY stdin doesn't, on 1.3.13 or 1.4.4. Waiting one macrotask before re-attaching fixes Bun, and Node behaves the same either way.

// Bun repro: no "readable" event ever fires again
stdin.on("data", function onData() {
  stdin.pause();
  stdin.removeListener("data", onData);
  stdin.addListener("readable", onReadable);
});

Created with Claude Opus 5.5

@BlankParticle

Copy link
Copy Markdown
Member Author

Superseded by #3, which fixes this in queryTerminal so every caller is covered.

@BlankParticle
BlankParticle deleted the blank/bun-query-reattach branch November 12, 2026 18:02
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