spin
spin copied to clipboard
Terminating the app while a prompt is waiting will not restore terminal settings
From https://github.com/fermyon/spin/discussions/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).
cc @jandubois
There is some activity on this over at dialoguer, but kind of inconclusive at the moment https://github.com/console-rs/dialoguer/issues/294
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.
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".