-
-
Notifications
You must be signed in to change notification settings - Fork 165
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
Flush terminal output when terminating. #256
Conversation
Hey, thanks for the contribution! Though I'm not sure this is the right way to solve this issue. The flush of The only way to even reach that points is by doing Secondly, I'm not really convinced this is even that big of a problem. I tested with other programs and the behaviour is the same, for example try cloning the linux kernel and type commands while it's running, those will get executed afterwards too. Though if this behaviour is a real problem in your use case we can look into making this work with |
@ardera You're right it doesn't solve the issue, we can ditch this PR. Re. the similarity with cloning the kernel, git is not an interactive program and is not supposed to eat your input - a flutter app accepting keyboard input is, in my opinion, more akin to vim - when I enter text in vim, I do not expect the input to be executed by the shell once I exit. The behavior is a problem in any use case where the app self-terminates (or crashes!). In our use case, we terminate the app for auto updates, but I'm not sure the shell would receive the input in that case. At least in one occasion though, it happened that I inputted EDIT: |
Ah I see, you're launching flutter-pi with your physical keyboard. I'm launching via ssh so I didn't see the issue. But in your case it totally makes sense. I think the issue is actually a bit more complicated. If you launch flutter-pi via ssh, but enter some text inside a flutter app via a physically-attached keyboard, the same keyboard events will still reach the console and possibly be executed. Then even the I actually found a blog post where some people had the exact same problem: https://blog.nanl.de/2011/06/linuxinput-devices-in-qt-embedded-take-care/ I think the solution could be to use That Furthermore, when the physical keyboard is grabbed, any Ctrl+C entered by that keyboard will no longer be seen by the terminal and won't terminate flutter-pi. I'm not sure what's the best way to go about this:
|
I like this, it gives the right flexibility :-) Sometimes, in development, it may be useful to test the app in release mode but still have the possibility to kill it by I'll prepare a PR for it if I can 👍 |
with
thx! |
Closing this for now, tracking it in #298 instead |
Keyboard input reaches the terminal after the program terminates.
It's possible to type entire commands that get executed once the app quits.
This PR discards the contents of
stdin
when the app terminates.There may be cases (crashes?) where this is not enough, but fixes the most common cases (
Ctrl-c
and flutter app termination viadart:io:exit()
).