Skip to content
  • Chris Down's avatar
    util: Flush cursor state to stdout before removing signal handler · ff7c6c8e
    Chris Down authored and Allan McRae's avatar Allan McRae committed
    It's possible that the cursor does not reappear after pressing ^C during
    shutdown. In my case, I noticed this when pressing ^C after getting
    results from `pacman -F` -- this can reasonably reliably be triggered by
    issuing a file query and pressing ^C shortly after results are shown.
    
    There are two reasons for this issue:
    
    1. The graceful SIGINT handler is removed at the start of cleanup(), but
       the window from entering cleanup() to reaching exit() is non trivial.
       The main offender is FREELIST(pm_targets), which on my T14s takes
       >0.1s to execute. This means that if you are unlucky enough to press
       ^C while there, the cursor isn't coming back, because we haven't
       issued any command to show the cursor again yet, and the userspace
       signal handler is already blown away.
    2. Moving console_cursor_show() to earlier in cleanup() only half solves
       the issue. While it's fine not to flush after _hiding_ the cursor,
       since it will at l...
    ff7c6c8e