This is in response to issue# d2aeb57, where the cursor is not shown when
interrupting rad when a progress spinner thread is present.
This is mainly achieved by adding signal handling for spinners now using radicle-signals and
crossbeam-channel. When a SIGINT signal fires off while a spinner is active, it will drop its
respective HideCursor object and exit the process entirely.
Some other somewhat related changes to this patch:
- to better pass on handling to the OS/another CLI element,
radicle-signals::uninstall()is implemented and used for the spinners.- the CLI pager also used
radicle-signals, so that was also modified to use the above
- the CLI pager also used
- doc changes to the spinner/pager to include the tidbits on signal handling
This is in response to issue# d2aeb57, where the cursor is not shown when
interrupting rad when a progress spinner thread is present.
This is mainly achieved by adding signal handling for spinners now using radicle-signals and
crossbeam-channel. When a SIGINT signal fires off while a spinner is active, it will drop its
respective HideCursor object and exit the process entirely.
Some other somewhat related changes to this patch:
- to better pass on handling to the OS/another CLI element,
radicle-signals::uninstall()is implemented and used for the spinners.- the CLI pager also used
radicle-signals, so that was also modified to use the above
- the CLI pager also used
- doc changes to the spinner/pager to include the tidbits on signal handling
No longer use ctrlc to handle interruption. Using radicle-signals + crossbeam_channel for that now.
Implementation of this is working but may need some (significant) improvement.
Clean up
Adhere to “Radicle house style choice” + improve(?) errors for init_channels()
radicle-signals can now uninstall handlers now.
- made spinner uninstall signal on any state of finish
Reason why I made that happen is because the pager also installs signal handlers and I didn’t want either to conflict.
I forgot to uninstall handlers for pagers so I’ll do that now
- Pagers now uninstall signal handlers when finished
(un)init_channels()now actually returnsio::Result<()>- ran
$ cargo fmt
remove CHANNEL static and (un)init_channel() functions.
- Don’t panic if we can’t install signal handlers, just keep spinning.
- also added sections to
spinner_to()/page()’s comments on signal handling (spinner()kinda counts but its mostly meant to redirect tospinner_to()).
_(un)install()iterates over a slice of signals (now constSIGNALS).
- use
sig_rx.try_recv()rather thanchan::select!for getting signals - draw spinner as being cancelled before exiting
- change exit code to -1 rather than 0
Rebase.