install: more little window fixes (#4930)
* Only add .exe extension if no extension was given * Switch to ctrlc crate for freebie Windows ^C handling
This commit is contained in:
@@ -20,6 +20,7 @@ bzip2 = "0.3.3"
|
||||
chrono = { version = "0.4.7", features = ["serde"] }
|
||||
clap = { version = "2.33.0" }
|
||||
console = "0.7.7"
|
||||
ctrlc = { version = "3.1.3", features = ["termination"] }
|
||||
dirs = "2.0.1"
|
||||
indicatif = "0.11.0"
|
||||
lazy_static = "1.3.0"
|
||||
@@ -38,9 +39,6 @@ tar = "0.4.26"
|
||||
tempdir = "0.3.7"
|
||||
url = "1.7.2"
|
||||
|
||||
[target."cfg(not(windows))".dependencies]
|
||||
signal-hook = "0.1.9"
|
||||
|
||||
[target."cfg(windows)".dependencies]
|
||||
winapi = "0.3.7"
|
||||
winreg = "0.6"
|
||||
|
@@ -750,7 +750,7 @@ pub fn run(
|
||||
let config = Config::load(config_file)?;
|
||||
|
||||
let mut full_program_path = config.active_release_bin_dir().join(program_name);
|
||||
if cfg!(windows) {
|
||||
if cfg!(windows) && full_program_path.extension().is_none() {
|
||||
full_program_path.set_extension("exe");
|
||||
}
|
||||
|
||||
@@ -764,18 +764,11 @@ pub fn run(
|
||||
let mut child_option: Option<std::process::Child> = None;
|
||||
let mut now = Instant::now();
|
||||
|
||||
let (_signal_sender, signal_receiver) = mpsc::channel();
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
use signal_hook::{iterator::Signals, SIGTERM};
|
||||
let signals = Signals::new(&[SIGTERM]).unwrap();
|
||||
std::thread::spawn(move || {
|
||||
for sig in signals.forever() {
|
||||
eprintln!("run: received signal {:?}", sig);
|
||||
let _ = _signal_sender.send(());
|
||||
}
|
||||
});
|
||||
}
|
||||
let (signal_sender, signal_receiver) = mpsc::channel();
|
||||
ctrlc::set_handler(move || {
|
||||
let _ = signal_sender.send(());
|
||||
})
|
||||
.expect("Error setting Ctrl-C handler");
|
||||
|
||||
loop {
|
||||
child_option = match child_option {
|
||||
|
Reference in New Issue
Block a user