mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 12:58:45 +08:00
Allow to print stats when recv ctrlc
This commit is contained in:
29
Cargo.lock
generated
29
Cargo.lock
generated
@@ -153,6 +153,12 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cfg_aliases"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.4.4"
|
||||
@@ -267,6 +273,16 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ctrlc"
|
||||
version = "3.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46f93780a459b7d656ef7f071fe699c4d3d2cb201c4b24d085b6ddc505276e73"
|
||||
dependencies = [
|
||||
"nix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
@@ -665,6 +681,7 @@ dependencies = [
|
||||
"clap",
|
||||
"clap-num",
|
||||
"csv",
|
||||
"ctrlc",
|
||||
"emote-psb",
|
||||
"encoding_rs",
|
||||
"fancy-regex",
|
||||
@@ -696,6 +713,18 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags 2.9.1",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
||||
@@ -9,6 +9,7 @@ blowfish = { version = "0.9", optional = true }
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
clap-num = "1.2"
|
||||
csv = "1.3"
|
||||
ctrlc = "3.4"
|
||||
emote-psb = { version = "0.5", optional = true }
|
||||
encoding_rs = "0.8"
|
||||
fancy-regex = { version = "0.14", optional = true }
|
||||
|
||||
@@ -1540,6 +1540,11 @@ lazy_static::lazy_static! {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = ctrlc::try_set_handler(|| {
|
||||
eprintln!("Aborted.");
|
||||
eprintln!("{}", std::ops::Deref::deref(&COUNTER));
|
||||
std::process::exit(1);
|
||||
});
|
||||
let arg = args::parse_args();
|
||||
if arg.backtrace {
|
||||
unsafe { std::env::set_var("RUST_LIB_BACKTRACE", "1") };
|
||||
|
||||
Reference in New Issue
Block a user