-
-
Notifications
You must be signed in to change notification settings - Fork 36
Handling ttys not accepting sequences e.g when suspended by Flow Control #22
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
Comments
huh interesting, after checking some stuff it seems the issue may be on how the who(1) program determines the active terminals, a sure fire way to check if a terminal or any process for that matter is active is with thankfully ps has the
the only important fields there are the tty and the status columns, so i would remove the uid and pid params from the ps command and we would get:
with that we would be able to parse the output, if the 'S' column is a i will try to have a branch ready to test this week |
Hmm, the state is not changing for me when I enable suspend mode, it returns exactly the same and man page mentions job control and not flow control, very similar name it made me think it was the same thing at first. So it sounds for me that the later requires a completely different check if it even exists? Also, interestingly enough, job control to the shell or the parent (Konsole here) doesn't stop tty receiving input: I've had it happen at random times but never tried to debug it and I don't make use of flow control myself, which is the only way i can manually reproduce this. So is either some software I use suspending a terminal (probably vscode) or a completely different issue perhaps? For now I will wait for the issue to happen again and try to debug it. |
There seemed to be some reports of this also happening in the old pywal repo. dylanaraps/pywal#40 (comment) I did come across this issue myself with WebStorm and I know I worked around it somehow, but I don't remember how. I updated to sway from i3 so I come across this daily again, I might be able to debug it or try things for y'all. |
Hi, I think I found a way to handle this, by using fcntl to set os.O_NONBLOCK flag before trying to write to the file. This way it fails immediately and we can simply log the error? |
That sounds like a reasonable approach, maybe @eylles can weight in on whether this is acceptable or not? |
checking the pr |
it works so far so closing this for now. |
Currently whenever a terminal is in suspended mode (and maybe for some other reasons) and pywal tries to send the color sequences to it the save_file here:
pywal16/pywal/sequences.py
Line 92 in 095b169
it will get stuck trying to write indefinitelly, blocking the writing to the remaining ttys and program itself
I tried this PR Add --active-only flag to only run pywal on active ttys from dylanaraps repo. But unfortunately it didn't work for Kitty, which doesn't show up in
who
output for some reason and also doesn't handle the aforementioned suspend mode.So I am wondering if there is a way to reliably detect whether a tty cannot receive input so it is skipped. Konsole links to this wiki page about Software Flow Control, could it be that there is a way to detect in which state a tty is? Or will it be okay putting a timeout to the write operation to abort when it gets stuck?
The text was updated successfully, but these errors were encountered: