charmbracelet / huh

Build terminal forms and prompts 🤷🏻‍♀️
MIT License
4.39k stars 126 forks source link

fix(accessibility): stop scanning on EOF from stdin #440

Open aybabtme opened 3 weeks ago

aybabtme commented 3 weeks ago

If a user send EOF to stdin (Ctrl-C) in the terminal while in accessibility mode, the program gets stuck in a loop printing errors about invalid input:

Example: CleanShot 2024-10-25 at 19 19 41 "oh nooo....." screams the terminal, as it decides into a demented spiral

This change isn't ideal (it'd be better to somehow bubble up an error that stops execution) but it's better than getting the process stuck in a loop. An alternative that doesn't change the signature would be to panic, or os.Exit or something else. Happy with whatever.