cargo-binstall
cargo-binstall copied to clipboard
Add Signal handling
This PR adds signal handling for:
-
ctrl_c
-
SIGINT
(unix) -
SIGHUP
(unix) -
SIGTERM
(unix) -
SIGQUIT
(unix) which will abort the program and clean up the resource it occupied.
It also ignores SIGUSR1
and SIGUSR2
on unix.
This PR fixed #268
Signed-off-by: Jiahao XU [email protected]
And now I have met a hard problem:
How to cancel the UI thread?
@passcod Do you have any suggestion here?
Oh I figured it out, it is because:
a) the ui thread is spawned using tokio::task::spawn_blocking
, which blocks drop(rt)
in main
.
b) the ui thread locks the stdout when confirming so that the main
thread cannot print anything and thus cannot exit.