Add a signal handler to reset the cursor on interrupt (#2603)
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
1dcfc44c23
commit
28d1b305c4
4 files changed
+16
-1
No files matched your search
Generated
+1
@@ -2417,6 +2417,7 @@ dependencies = [
|
||||
"chrono",
|
||||
"clap 4.5.9",
|
||||
"colored 2.1.0",
|
||||
"console",
|
||||
"console-subscriber",
|
||||
"crossterm",
|
||||
"ctrlc",
|
||||
|
||||
@@ -41,8 +41,11 @@ hyper-rustls = { workspace = true }
|
||||
rustls = {version="0.23.11", default-features=false, features =["logging","std","tls12","ring"]}
|
||||
subprocess = "0.2.9"
|
||||
rayon = "1.8.0"
|
||||
console = "0.15.8"
|
||||
ctrlc = "3.2.3"
|
||||
futures-channel = { workspace = true }
|
||||
krates = { version = "0.17.0" }
|
||||
|
||||
axum = { workspace = true, features = ["ws"] }
|
||||
axum-server = { workspace = true, features = ["tls-rustls"] }
|
||||
axum-extra = { workspace = true, features = ["typed-header"] }
|
||||
@@ -68,7 +71,6 @@ tower = { workspace = true }
|
||||
once_cell = "1.19.0"
|
||||
|
||||
# plugin packages
|
||||
ctrlc = "3.2.3"
|
||||
open = "5.0.1"
|
||||
cargo-generate = "=0.21.1"
|
||||
toml_edit = "0.22.15"
|
||||
|
||||
@@ -42,6 +42,12 @@ impl Create {
|
||||
if self.yes && args.name.is_none() {
|
||||
return Err("You have to provide the project's name when using `--yes` option.".into());
|
||||
}
|
||||
// https://github.com/console-rs/dialoguer/issues/294
|
||||
ctrlc::set_handler(move || {
|
||||
let _ = console::Term::stdout().show_cursor();
|
||||
std::process::exit(0);
|
||||
})
|
||||
.expect("ctrlc::set_handler");
|
||||
let path = cargo_generate::generate(args)?;
|
||||
post_create(&path)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@ impl Init {
|
||||
let name = std::env::current_dir()?
|
||||
.file_name()
|
||||
.map(|f| f.to_str().unwrap().to_string());
|
||||
// https://github.com/console-rs/dialoguer/issues/294
|
||||
ctrlc::set_handler(move || {
|
||||
let _ = console::Term::stdout().show_cursor();
|
||||
std::process::exit(0);
|
||||
})
|
||||
.expect("ctrlc::set_handler");
|
||||
let args = GenerateArgs {
|
||||
define: self.option,
|
||||
init: true,
|
||||
|
||||
Reference in new issue
Block a user