Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add empty ctrlc handler on Windows. #6002

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ rustc-workspace-hack = "1.0.0"
core-foundation = { version = "0.6.0", features = ["mac_os_10_7_support"] }

[target.'cfg(windows)'.dependencies]
ctrlc = "3.1.1"
miow = "0.3.1"
fwdansi = "1"

Expand Down
2 changes: 2 additions & 0 deletions src/cargo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ extern crate clap;
extern crate core_foundation;
extern crate crates_io as registry;
extern crate crossbeam_utils;
#[cfg(windows)]
extern crate ctrlc;
extern crate curl;
#[macro_use]
extern crate failure;
Expand Down
4 changes: 3 additions & 1 deletion src/cargo/util/process_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ impl ProcessBuilder {

/// On unix, executes the process using the unix syscall `execvp`, which will block this
/// process, and will only return if there is an error. On windows this is a synonym for
/// `exec`.
/// `exec`, except we install a ctrlc handler first to prevent us from eating
/// the signal the subprocess may care about.
#[cfg(windows)]
pub fn exec_replace(&self) -> CargoResult<()> {
::ctrlc::set_handler(move || {} )?;
self.exec()
}

Expand Down