1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

fixup windows build

refs: https://github.com/wez/wezterm/issues/839
This commit is contained in:
Wez Furlong 2021-05-31 22:39:26 -07:00
parent ab2918d568
commit 20c4dcdc36

View File

@ -27,10 +27,6 @@ use wezterm_term::{
Alert, AlertHandler, CellAttributes, Clipboard, KeyCode, KeyModifiers, MouseEvent, Alert, AlertHandler, CellAttributes, Clipboard, KeyCode, KeyModifiers, MouseEvent,
SemanticZone, StableRowIndex, Terminal, SemanticZone, StableRowIndex, Terminal,
}; };
#[cfg(windows)]
use winapi::um::synchapi::WaitForSingleObject;
#[cfg(windows)]
use winapi::um::winbase::INFINITE;
#[derive(Debug)] #[derive(Debug)]
enum ProcessState { enum ProcessState {
@ -552,7 +548,6 @@ impl AlertHandler for LocalPaneNotifHandler {
#[derive(Debug)] #[derive(Debug)]
struct ProcessSignaller { struct ProcessSignaller {
#[cfg(unix)]
pid: Option<u32>, pid: Option<u32>,
#[cfg(windows)] #[cfg(windows)]
@ -562,9 +557,10 @@ struct ProcessSignaller {
impl ProcessSignaller { impl ProcessSignaller {
#[cfg(windows)] #[cfg(windows)]
fn kill(&self) -> IoResult<()> { fn kill(&self) -> IoResult<()> {
if let Some(handle) = self.handle { if let Some(handle) = &self.handle {
unsafe { 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()); return Err(std::io::Error::last_os_error());
} }
} }
@ -607,10 +603,11 @@ fn split_child(
} }
signaller = ProcessSignaller { signaller = ProcessSignaller {
pid: process.process_id(),
handle: process handle: process
.as_raw_handle() .as_raw_handle()
.as_ref() .as_ref()
.map(|h| OwnedHandle::dup(&RawDup(*h))), .and_then(|h| OwnedHandle::dup(&RawDup(*h)).ok()),
}; };
} }