-
Notifications
You must be signed in to change notification settings - Fork 74
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
Inquire leaves the terminal in a broken state #225
Comments
lol, I guess I never paid attention to the bug report template handling sigterm is a tricky thing in and of itself, and I honestly have no idea on which role inquire should take, being a library do you have any ideas in mind? or better yet, references on how other libs solve this issue? one of the options would be to add signal handling behind a feature, and those interested in it can opt-in on the additional dependency, but then again, tricky :) |
Hm well I foolishly assumed that sigterm is handled nicely by rust by default, i.e. that it runs stuff like
I think tokio does it quite nicely - they seem to register some form of signal handler that just stores the received signals for the application to process. At least thats how I interpret their documentation: https://docs.rs/tokio/latest/tokio/signal/index.html. The best way would probably be to have something like this as part of std so that all applications and libraries share that api instead of doing it their way, but I guess that's not a reality right now. |
Yeah, one thing I've realized with this crate is there are two conflicting goals here, either make it simple and lean or a highly customizable thing that tries to support all scenarios. Adding a signal handler is more of the latter, and I have been seriously wondering if inquire is accumulating a lot of bloat (e.g. see the Text prompt), and is missing the initial goal of simple prompts From my own experience, cli apps breaking on unexpected events (resizing, signals) is often the norm, so I'm wondering how much a new feature to handle sigterm would actually be used. Because then I'll have to start adding some inter thread communication, change some lifecycle things, etc |
Describe the bug
When you
kill
a program that currently has an open inquire prompt, i.e. nicely ask the program to shut down, inquire does not properly clean up after itself. Instead, the terminal is left in a bad state where it does not echo back commands and my prompts are randomly indented by a tab or so. Typingreset
of course fixes this but is something I should not have to do manually.Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: