Skip to content

fix(cli): use line-based stdin read for gateway recreate prompt#292

Merged
drew merged 2 commits intomainfrom
fix-gateway-start-prompt/an
Mar 13, 2026
Merged

fix(cli): use line-based stdin read for gateway recreate prompt#292
drew merged 2 commits intomainfrom
fix-gateway-start-prompt/an

Conversation

@drew
Copy link
Copy Markdown
Collaborator

@drew drew commented Mar 13, 2026

Summary

  • Replace dialoguer::Confirm::interact() with std::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 input
  • Fix interactive detection to check both stdin and stderr are TTYs (std::io::stdin().is_terminal() && std::io::stderr().is_terminal()), matching the pattern used in gateway_select
  • Restore volume only status label and image info in the prompt output

Context

After the gateway teardown consolidation in #281, openshell gateway start with an existing gateway shows the "Destroy and recreate?" prompt but exits immediately without waiting for user input. The dialoguer::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-cli passes
  • mise run pre-commit passes

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 drew self-assigned this Mar 13, 2026
@drew drew merged commit 7dfca7f into main Mar 13, 2026
9 checks passed
@drew drew deleted the fix-gateway-start-prompt/an branch March 13, 2026 22:51
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