From 20c4dcdc36e0f72a7de0dbf56304331f0bd9639a Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 31 May 2021 22:39:26 -0700 Subject: [PATCH] fixup windows build refs: https://github.com/wez/wezterm/issues/839 --- mux/src/localpane.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/mux/src/localpane.rs b/mux/src/localpane.rs index bb9d801f7..9db7a8d82 100644 --- a/mux/src/localpane.rs +++ b/mux/src/localpane.rs @@ -27,10 +27,6 @@ use wezterm_term::{ Alert, AlertHandler, CellAttributes, Clipboard, KeyCode, KeyModifiers, MouseEvent, SemanticZone, StableRowIndex, Terminal, }; -#[cfg(windows)] -use winapi::um::synchapi::WaitForSingleObject; -#[cfg(windows)] -use winapi::um::winbase::INFINITE; #[derive(Debug)] enum ProcessState { @@ -552,7 +548,6 @@ impl AlertHandler for LocalPaneNotifHandler { #[derive(Debug)] struct ProcessSignaller { - #[cfg(unix)] pid: Option, #[cfg(windows)] @@ -562,9 +557,10 @@ struct ProcessSignaller { impl ProcessSignaller { #[cfg(windows)] fn kill(&self) -> IoResult<()> { - if let Some(handle) = self.handle { + if let Some(handle) = &self.handle { unsafe { - if !winapi::um::processthreadsapi::TerminateProcess(self.handle, 127) { + if winapi::um::processthreadsapi::TerminateProcess(handle.as_raw_handle(), 127) == 0 + { return Err(std::io::Error::last_os_error()); } } @@ -607,10 +603,11 @@ fn split_child( } signaller = ProcessSignaller { + pid: process.process_id(), handle: process .as_raw_handle() .as_ref() - .map(|h| OwnedHandle::dup(&RawDup(*h))), + .and_then(|h| OwnedHandle::dup(&RawDup(*h)).ok()), }; }