fix(cli): restore paused stdin after capability detection - #28889
fix(cli): restore paused stdin after capability detection#28889sylvesterkaczmarek wants to merge 3 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where terminal capability detection inadvertently leaves stdin in a flowing mode, causing subsequent keyboard input to be lost. By tracking the stream's state before detection and conditionally calling pause, the fix ensures that the terminal remains responsive for subsequent consumers like Ink. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
📊 PR Size: size/M
|
There was a problem hiding this comment.
Code Review
This pull request ensures that process.stdin is paused after temporary terminal capability detection if it was not already flowing. This prevents keyboard input from being discarded before Ink attaches its consumer. A new test file has been added to verify this behavior. I have no feedback to provide as the implementation is correct and there are no review comments.
Fixes #28799
Summary
Why
detectCapabilities()temporarily attaches adatalistener toprocess.stdin. In Node.js, adding adatalistener switches a readable stream into flowing mode, and removing that listener does not automatically pause the stream again. With no consumer attached, subsequent input can be discarded before Ink installs itsreadableconsumer.This matches #28799's observed state: terminal capability detection completes, the TUI renders, but the tty is never subsequently consumed and keyboard input is lost.
The cleanup now restores the pre-detection non-flowing state by calling
pause()only when stdin was not already flowing.Validation
Added focused tests in
packages/cli/src/ui/utils/terminalCapabilityManager.stdin-flow.test.tscovering: