Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli: Handle ctrl+c interrupts during an active spinner thread
Merged did:key:z6Mktnv1...8DHL opened 1 year ago

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
  • doc changes to the spinner/pager to include the tidbits on signal handling
did:key:z6Mktnv1...8DHL opened with revision 6fd6891f on base 92c9e218 +45 -1 1 year ago

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
  • doc changes to the spinner/pager to include the tidbits on signal handling
did:key:z6Mktnv1...8DHL pushed revision 2 bb1e20e2 on base 92c9e218 +33 -4 1 year ago

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.

did:key:z6Mktnv1...8DHL pushed revision 3 1f5fdeaf on base 92c9e218 +51 -2 1 year ago

Clean up

did:key:z6Mktnv1...8DHL pushed revision 4 18f9f61c on base 92c9e218 +51 -2 1 year ago
did:key:z6Mktnv1...8DHL pushed revision 5 aa5d8da2 on base 92c9e218 +60 -2 1 year ago

Adhere to “Radicle house style choice” + improve(?) errors for init_channels()

did:key:z6Mktnv1...8DHL pushed revision 6 0b7e9504 on base 92c9e218 +117 -2 1 year ago

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

did:key:z6Mktnv1...8DHL pushed revision 7 a432d044 on base 92c9e218 +131 -3 1 year ago
  • Pagers now uninstall signal handlers when finished
  • (un)init_channels() now actually returns io::Result<()>
  • ran $ cargo fmt
did:key:z6Mktnv1...8DHL pushed revision 8 5204884c on base 92c9e218 +79 -3 1 year ago

remove CHANNEL static and (un)init_channel() functions.

did:key:z6Mktnv1...8DHL pushed revision 9 48053c25 on base 92c9e218 +93 -4 1 year ago
  • 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 to spinner_to()).
did:key:z6Mktnv1...8DHL pushed revision 10 c3f33ea7 on base 92c9e218 +90 -14 1 year ago
  • _(un)install() iterates over a slice of signals (now const SIGNALS).
did:key:z6Mktnv1...8DHL pushed revision 11 92631606 on base 92c9e218 +92 -14 1 year ago
  • use sig_rx.try_recv() rather than chan::select! for getting signals
  • draw spinner as being cancelled before exiting
  • change exit code to -1 rather than 0
did:key:z6MksFqX...wzpT pushed revision 12 52473f08 on base a831e18a +90 -14 1 year ago

Rebase.

did:key:z6MksFqX...wzpT merged revision 52473f08 at 1848c2b8 1 year ago