File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ git2 = "0.14.0"
4545nix = " 0.20.0"
4646
4747[target .'cfg(windows)' .dependencies ]
48- winapi = " 0.3 "
48+ windows-sys = { version = " 0.36.1 " , features = [ " Win32_Foundation " , " Win32_System_Threading " ]}
4949
5050[dev-dependencies ]
5151env_logger = " 0.8"
Original file line number Diff line number Diff line change @@ -3,16 +3,15 @@ use crate::cmd::KillFailedError;
33use failure:: { bail, Error } ;
44use std:: fs:: File ;
55use std:: path:: Path ;
6- use winapi:: um:: handleapi:: CloseHandle ;
7- use winapi:: um:: processthreadsapi:: { OpenProcess , TerminateProcess } ;
8- use winapi:: um:: winnt:: PROCESS_TERMINATE ;
6+ use windows_sys:: Win32 :: Foundation :: CloseHandle ;
7+ use windows_sys:: Win32 :: System :: Threading :: { OpenProcess , TerminateProcess , PROCESS_TERMINATE } ;
98
109pub ( crate ) fn kill_process ( id : u32 ) -> Result < ( ) , KillFailedError > {
1110 let error = Err ( KillFailedError { pid : id } ) ;
1211
1312 unsafe {
1413 let handle = OpenProcess ( PROCESS_TERMINATE , 0 , id) ;
15- if handle. is_null ( ) {
14+ if handle == 0 || handle == - 1 {
1615 return error;
1716 }
1817 if TerminateProcess ( handle, 101 ) == 0 {
You can’t perform that action at this time.
0 commit comments