-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
fix: restore SIGHUP in signal handler #1305
Conversation
Restore the SIGHUP signal handler which was accidentally removed in a067ab2.
I should have checked the previous PR better to make sure I didn't mix them up. This fixes it. |
@hrkfdn I'm keeping this one as a draft for now because I found a pretty annoying issue that occurs when this is merged: When I don't know the difference between closing the tab or closing the terminal emulator. I thought it should behave the same. I think it would be best to wait with merging this and maybe even revert the previous merge as it might also show this behavior. I haven't had the chance to test yet, just want to make sure this isn't released or kept in main for too long as it's pretty annoying. Sorry for these two bad PRs, but it has been hard to test every possible combination (signals, terminal multiplexer, terminal itself...) between the two PRs (SIGHUP and async signal handling). I also assumed that if it worked when closing it in a multiplexer pane, it would also work when closing the terminal. I'll see whether I can improve the async version and make sure it works properly. |
No worries, I am also able to reproduce the delayed termination as well as the CPU hogging on macOS, but didn't have time to investigate further. |
I tried to look further into this and added some logging to see exactly where the problem occurs (my debugger doesn't work well with async stuff and will instead open a file with assembly, which is not useful). Log output when manually sending
Log output when quit by closing Zellij pane (filtered with
The case where it's closed from the terminal gives this output (filtered with
Adding further logging shows that the signal handler sends the closure which executes the |
The event loop blocks on something when the callback is sent from the signal handler task. I'm still kind of lost...
|
From what I can see, it's an issue introduced by the crossterm backend. The ncurses one doesn't keep the process running. Currently I suspect Cursive is doing a write to @hrkfdn This would solve #1309 and #1310 and #1282. I'd love to hear thoughts on this idea. If it's an OK solution, I'd try to see whether I can open an issue at Cursive or Crossterm to resolve the issue there, and meanwhile switch backend and add the SIGHUP handler back to finally close all these issues 😅 |
Oh FFS, I'm so pissed. This happens every time! You put hours into solving an issue only to find it's a known issue elsewhere 🤣. Lesson learned (he says as he will just do the same thing next time) crossterm-rs/crossterm#793 |
Ugh, there really is no perfect backend it seems. Switching back to Termion will break Shift+Up/Shift+Down keybindings to move items around in the queue. Crossterm has this CPU hogging bug. Pancurses doesn't work well with 256 colors.. 😭 |
TBH Crossterm seems pretty dea... on vacation for now. Termion is... what is the right word... retired? Pancurses has been chilling since 2021. I think the safest, most robust option right now would be to switch to ncurses by default as it's the most well known library. It's not that I don't believe in the other ones, but terminals are complex to handle and ncurses has the advantage of using the terminfo library, which the other backends don't (I think). |
Yeah, I'm hoping to have to time to finally look at all of this (and other issues/PRs) this weekend. Been super busy these past weeks unfortunately, sorry for all the delays.. |
No problem at all. I understand that maintainers aren't available 24/7. I'm just making PRs as I'm fixing/improving things and I know it can take some time before they are discussed. Until then, I'll just work on other stuff 🙂 |
Restore the SIGHUP signal handler which was accidentally removed in a067ab2.