fix(cli): use line-based stdin read for gateway recreate prompt#292
Merged
fix(cli): use line-based stdin read for gateway recreate prompt#292
Conversation
dialoguer::Confirm::interact() puts the terminal into raw mode, which causes the prompt to return immediately without waiting for user input in some terminal environments. Replace with std::io::stdin().read_line() which blocks reliably on a full line of input. Also fix the interactive detection to check both stdin and stderr are TTYs (matching the pattern used in gateway_select), and restore the 'volume only' status label and image info in the prompt.
drew
added a commit
that referenced
this pull request
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dialoguer::Confirm::interact()withstd::io::stdin().read_line()for the gateway recreate prompt —interact()puts the terminal in raw mode which causes it to return immediately without waiting for inputstd::io::stdin().is_terminal() && std::io::stderr().is_terminal()), matching the pattern used ingateway_selectvolume onlystatus label and image info in the prompt outputContext
After the gateway teardown consolidation in #281,
openshell gateway startwith an existing gateway shows the "Destroy and recreate?" prompt but exits immediately without waiting for user input. Thedialoguer::Confirm::interact()call uses raw terminal mode which fails silently in some environments, causing the default (No) to be accepted instantly.The fix reverts to the proven
stdin().read_line()approach which blocks reliably on a full line of input.Test Plan
cargo check -p openshell-clipassesmise run pre-commitpasses