-
Notifications
You must be signed in to change notification settings - Fork 112
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
support ctrl+z stop process #65
Comments
Thanks for letting me know! I have had a preliminary look and here are my findings.
Knowing how obtaining input works, I do wonder what else has to happen to make this work. I have a feeling it's something the application has to be aware of, and possibly rebind standard input somehow. When trying the above with Next I will continue checking what happens when doing this in |
I think I know what happens. After interruption, the input thread crashes and for some reason doesn't bring down the program with it (which it really should at least). Thus it leaves the application unresponsive. That should easily be fixable, let me see…. |
Even though it's trivial to ignore interrupts, it appears that's not actually happening in case of dua. Previously the input thread would gracefully shutdown, and leave the main loop input loop with a closed channel which should unblock and stop naturally.
As of now, I am none the wiser though on how to fix that, and the question remains why connectivity to the terminal is lost entirely. Ok, here it comes: The terminal is loosing it's RAW mode, which is why now one can actually see all input. Thus pressing enter dispatches all input to the application, which will happily draw then as well. Thus the solution should be to set a handler for SIGCONT and set the terminal back into raw mode. |
Any thoughts on this would be appreciated - it puzzles me that this is not done automatically. It appears like As I will sleep on that and see if support for that can be implemented in |
This article for the first time in my life explains how all this is actually working. Very interesting, even after only having read the first 10% or so. |
Thanks for all the effort you put into this! That article was helpful for me, too. I read up to
then tested it out on Then, I think that |
I could just reproduce this behaviour with the
Now the user should be able to interact with a pristine terminal. Once CONT is received, the application restores the previously current terminal settings and uninstalls the CONT signal handler and potentially reinstalls the SIGTSTP handler to get ready for the next background request. If the application wanted to, it could always install a CONT handler to be able to always restore the correct terminal settings, even in case of STOP having been received earlier. Now is the question how to handle it. My first intuition is to put that into The sig crate could probably be used to send signals to a process using libc, which I suspect lacks windows support. There seem to be plenty of issues it might be more feasible to implement this as no-op on windows at first. |
Additionally, I have created an issue over at termion, pointing to the corresponding |
I want to implement this for helix editor as well https://github.com/helix-editor/helix but seemed like we need to use low-level library for this directly using signal-hook. |
In interactive
dua i
, Ctrl+Z doesn't work. It does nothing. If I stop the process usingkill -STOP <pid>
on a separate terminal, it does stop. If Ifg
it on that terminal, it starts again, but the graphical interface is not there. Whatever I type seems to have no affect, and the text I type just shows. It even doesn't recognize Ctrl+C (in most cases). So Ikill -KILL <pid>
, and all the keys I inputted are spit out on that terminal.Ideally, I would like Ctrl+Z to stop the process like many other programs.
The text was updated successfully, but these errors were encountered: