fixed keyboard interrupt

This commit is contained in:
Joshua Perry 2024-07-21 20:22:47 +01:00
parent 78583d4f06
commit 8e64d354c3
3 changed files with 35 additions and 1 deletions

29
Cargo.lock generated
View File

@ -62,6 +62,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "clap"
version = "4.4.13"
@ -118,6 +124,16 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "ctrlc"
version = "3.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "672465ae37dc1bc6380a6547a8883d5dd397b0f1faaad4f265726cc7042a5345"
dependencies = [
"nix",
"windows-sys 0.52.0",
]
[[package]]
name = "errno"
version = "0.3.9"
@ -169,6 +185,18 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "nix"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
"bitflags",
"cfg-if",
"cfg_aliases",
"libc",
]
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -271,6 +299,7 @@ version = "0.1.0"
dependencies = [
"clap",
"colored",
"ctrlc",
"rand",
"tempfile",
]

View File

@ -8,6 +8,7 @@ publish = ["gitea"]
[dependencies]
clap = { version = "4.4.12", features = ["derive"] }
ctrlc = "3.4.4"
colored = "2.1.0"
rand = "0.8.5"

View File

@ -1,4 +1,8 @@
/// Entrypoint for the main binary.
fn main() {
ctrlc::set_handler(move || {
println!();
std::process::exit(1);
}).unwrap();
term_header::run();
}
} //TODO: Handle all unwraps