diff --git a/pty/src/lib.rs b/pty/src/lib.rs index a96c3f285..acd4ef008 100644 --- a/pty/src/lib.rs +++ b/pty/src/lib.rs @@ -233,7 +233,8 @@ impl ChildKiller for ProcessSignaller { fn kill(&mut self) -> IoResult<()> { if let Some(handle) = &self.handle { unsafe { - if winapi::um::processthreadsapi::TerminateProcess(handle.as_raw_handle(), 127) == 0 + if winapi::um::processthreadsapi::TerminateProcess(handle.as_raw_handle() as _, 127) + == 0 { return Err(std::io::Error::last_os_error()); } diff --git a/pty/src/win/mod.rs b/pty/src/win/mod.rs index 11bd7debf..24f8f5369 100644 --- a/pty/src/win/mod.rs +++ b/pty/src/win/mod.rs @@ -26,7 +26,7 @@ impl WinChild { fn is_complete(&mut self) -> IoResult> { let mut status: DWORD = 0; let proc = self.proc.lock().unwrap().try_clone().unwrap(); - let res = unsafe { GetExitCodeProcess(proc.as_raw_handle(), &mut status) }; + let res = unsafe { GetExitCodeProcess(proc.as_raw_handle() as _, &mut status) }; if res != 0 { if status == STILL_ACTIVE { Ok(None) @@ -40,7 +40,7 @@ impl WinChild { fn do_kill(&mut self) -> IoResult<()> { let proc = self.proc.lock().unwrap().try_clone().unwrap(); - let res = unsafe { TerminateProcess(proc.as_raw_handle(), 1) }; + let res = unsafe { TerminateProcess(proc.as_raw_handle() as _, 1) }; let err = IoError::last_os_error(); if res != 0 { Err(err) @@ -69,7 +69,7 @@ pub struct WinChildKiller { impl ChildKiller for WinChildKiller { fn kill(&mut self) -> IoResult<()> { - let res = unsafe { TerminateProcess(self.proc.as_raw_handle(), 1) }; + let res = unsafe { TerminateProcess(self.proc.as_raw_handle() as _, 1) }; let err = IoError::last_os_error(); if res != 0 { Err(err) @@ -95,10 +95,10 @@ impl Child for WinChild { } let proc = self.proc.lock().unwrap().try_clone().unwrap(); unsafe { - WaitForSingleObject(proc.as_raw_handle(), INFINITE); + WaitForSingleObject(proc.as_raw_handle() as _, INFINITE); } let mut status: DWORD = 0; - let res = unsafe { GetExitCodeProcess(proc.as_raw_handle(), &mut status) }; + let res = unsafe { GetExitCodeProcess(proc.as_raw_handle() as _, &mut status) }; if res != 0 { Ok(ExitStatus::with_exit_code(status)) } else { @@ -107,7 +107,7 @@ impl Child for WinChild { } fn process_id(&self) -> Option { - let res = unsafe { GetProcessId(self.proc.lock().unwrap().as_raw_handle()) }; + let res = unsafe { GetProcessId(self.proc.lock().unwrap().as_raw_handle() as _) }; if res == 0 { None } else { @@ -138,7 +138,7 @@ impl std::future::Future for WinChild { let waker = cx.waker().clone(); std::thread::spawn(move || { unsafe { - WaitForSingleObject(handle.0, INFINITE); + WaitForSingleObject(handle.0 as _, INFINITE); } waker.wake(); }); diff --git a/pty/src/win/psuedocon.rs b/pty/src/win/psuedocon.rs index bca0a1520..223f76c97 100644 --- a/pty/src/win/psuedocon.rs +++ b/pty/src/win/psuedocon.rs @@ -10,7 +10,6 @@ use std::io::Error as IoError; use std::mem; use std::os::windows::ffi::OsStringExt; use std::os::windows::io::{AsRawHandle, FromRawHandle}; -use std::os::windows::raw::HANDLE; use std::path::Path; use std::ptr; use std::sync::Mutex; @@ -22,6 +21,7 @@ use winapi::um::winbase::{ CREATE_UNICODE_ENVIRONMENT, EXTENDED_STARTUPINFO_PRESENT, STARTF_USESTDHANDLES, STARTUPINFOEXW, }; use winapi::um::wincon::COORD; +use winapi::um::winnt::HANDLE; pub type HPCON = HANDLE; @@ -80,8 +80,8 @@ impl PsuedoCon { let result = unsafe { (CONPTY.CreatePseudoConsole)( size, - input.as_raw_handle(), - output.as_raw_handle(), + input.as_raw_handle() as _, + output.as_raw_handle() as _, PSEUDOCONSOLE_RESIZE_QUIRK | PSEUDOCONSOLE_WIN32_INPUT_MODE, &mut con, ) @@ -161,8 +161,8 @@ impl PsuedoCon { // Make sure we close out the thread handle so we don't leak it; // we do this simply by making it owned - let _main_thread = unsafe { OwnedHandle::from_raw_handle(pi.hThread) }; - let proc = unsafe { OwnedHandle::from_raw_handle(pi.hProcess) }; + let _main_thread = unsafe { OwnedHandle::from_raw_handle(pi.hThread as _) }; + let proc = unsafe { OwnedHandle::from_raw_handle(pi.hProcess as _) }; Ok(WinChild { proc: Mutex::new(proc),