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",
|
"chrono",
|
||||||
"clap 4.5.9",
|
"clap 4.5.9",
|
||||||
"colored 2.1.0",
|
"colored 2.1.0",
|
||||||
|
"console",
|
||||||
"console-subscriber",
|
"console-subscriber",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"ctrlc",
|
"ctrlc",
|
||||||
|
|||||||
@@ -41,8 +41,11 @@ hyper-rustls = { workspace = true }
|
|||||||
rustls = {version="0.23.11", default-features=false, features =["logging","std","tls12","ring"]}
|
rustls = {version="0.23.11", default-features=false, features =["logging","std","tls12","ring"]}
|
||||||
subprocess = "0.2.9"
|
subprocess = "0.2.9"
|
||||||
rayon = "1.8.0"
|
rayon = "1.8.0"
|
||||||
|
console = "0.15.8"
|
||||||
|
ctrlc = "3.2.3"
|
||||||
futures-channel = { workspace = true }
|
futures-channel = { workspace = true }
|
||||||
krates = { version = "0.17.0" }
|
krates = { version = "0.17.0" }
|
||||||
|
|
||||||
axum = { workspace = true, features = ["ws"] }
|
axum = { workspace = true, features = ["ws"] }
|
||||||
axum-server = { workspace = true, features = ["tls-rustls"] }
|
axum-server = { workspace = true, features = ["tls-rustls"] }
|
||||||
axum-extra = { workspace = true, features = ["typed-header"] }
|
axum-extra = { workspace = true, features = ["typed-header"] }
|
||||||
@@ -68,7 +71,6 @@ tower = { workspace = true }
|
|||||||
once_cell = "1.19.0"
|
once_cell = "1.19.0"
|
||||||
|
|
||||||
# plugin packages
|
# plugin packages
|
||||||
ctrlc = "3.2.3"
|
|
||||||
open = "5.0.1"
|
open = "5.0.1"
|
||||||
cargo-generate = "=0.21.1"
|
cargo-generate = "=0.21.1"
|
||||||
toml_edit = "0.22.15"
|
toml_edit = "0.22.15"
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ impl Create {
|
|||||||
if self.yes && args.name.is_none() {
|
if self.yes && args.name.is_none() {
|
||||||
return Err("You have to provide the project's name when using `--yes` option.".into());
|
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)?;
|
let path = cargo_generate::generate(args)?;
|
||||||
post_create(&path)
|
post_create(&path)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ impl Init {
|
|||||||
let name = std::env::current_dir()?
|
let name = std::env::current_dir()?
|
||||||
.file_name()
|
.file_name()
|
||||||
.map(|f| f.to_str().unwrap().to_string());
|
.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 {
|
let args = GenerateArgs {
|
||||||
define: self.option,
|
define: self.option,
|
||||||
init: true,
|
init: true,
|
||||||
|
|||||||
Reference in new issue
Block a user