Skip to content

fix: release stdin after the hidden key prompt so connect can exit - #9

Open
mikeyb wants to merge 1 commit into
Birdabo404:mainfrom
mikeyb:fix/connect-stdin-hang
Open

fix: release stdin after the hidden key prompt so connect can exit#9
mikeyb wants to merge 1 commit into
Birdabo404:mainfrom
mikeyb:fix/connect-stdin-hang

Conversation

@mikeyb

@mikeyb mikeyb commented Aug 26, 2026

Copy link
Copy Markdown

After a successful cribble connect, the CLI hangs in interactive terminals until Ctrl+C. This affects all platforms and predates 1.4 — piped input masks it because EOF closes stdin either way.

readHiddenLine restores stdin with if (wasPaused) input.pause(), but isPaused() returns flowing === false, and a fresh process.stdin has flowing === null — so the resume() used for hidden entry is never undone and the still-referenced TTY handle keeps the event loop alive.

The prompt now records whether stdin was actually flowing beforehand (readableFlowing === true) and pauses it again whenever it was not. A regression test uses a process.stdin-like fake that starts with readableFlowing = null.

readHiddenLine restored stdin with `if (wasPaused) input.pause()`, but
isPaused() is false for a stream that has never started flowing (the
state of a fresh process.stdin), so the resume() for hidden entry was
never undone. The still-referenced TTY handle kept the event loop
alive, and `cribble connect` hung after a successful save until the
user pressed Ctrl+C. Piped input masked the bug because EOF closes
stdin either way; only real interactive terminals hang.

Track whether stdin was actually flowing before the prompt and pause
it again whenever it was not.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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