Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminating the app while a prompt is waiting will not restore terminal settings #2557

Open
lann opened this issue Jun 13, 2024 · 4 comments · May be fixed by #2559
Open

Terminating the app while a prompt is waiting will not restore terminal settings #2557

lann opened this issue Jun 13, 2024 · 4 comments · May be fixed by #2559

Comments

@lann
Copy link
Collaborator

lann commented Jun 13, 2024

From #2555:

Any time the spin program displays a prompt, waiting for a single keypress, it hides the cursor, e.g.

Are you sure you want to continue? [Y/n]

If I press ⌃C instead of pressing y or n, then the program aborts, but the cursor remains invisible (I'm using iTerm2.app on macOS).

I believe this could be fixed by hooking SIGINT (as we do for spin up via the ctrlc crate) and calling https://docs.rs/console/0.15.7/console/struct.Term.html#method.show_cursor (via dialoguer::console).

@lann
Copy link
Collaborator Author

lann commented Jun 13, 2024

cc @jandubois

@itowlson
Copy link
Contributor

There is some activity on this over at dialoguer, but kind of inconclusive at the moment console-rs/dialoguer#294

@itowlson
Copy link
Contributor

itowlson commented Jun 13, 2024

Sigh. Showing the cursor makes it display Error: read interrupted on a Ctrl+C. From the issue it seems like we might need to handle this on every dialoguer error. I will... see if we can not. Except... in Ctrl+C you don't get to go down an error path. I am not sure what is going on in those suggestions.

@itowlson
Copy link
Contributor

Ha ha, but setting up the handler at the top level prevents us from Ctrl+C-ing out of normal prompts, it just goes round in a loop with "Invalid value: read interrupted".

@itowlson itowlson linked a pull request Jun 13, 2024 that will close this issue
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 a pull request may close this issue.

2 participants