pty: windows: fix kill() (#7709)

Fix inverted logic when considering the return value from the TerminateProcess call.
This commit is contained in:
Xuntao Chi authored and GitHub committed 2026-06-07 08:24:27 +01:00
1 parent 29d01fc8e5
commit 8afe0ad307
1 file changed
+2 -2
+2 -2
View File
@@ -42,7 +42,7 @@ impl WinChild {
let proc = self.proc.lock().unwrap().try_clone().unwrap();
let res = unsafe { TerminateProcess(proc.as_raw_handle() as _, 1) };
let err = IoError::last_os_error();
if res != 0 {
if res == 0 {
Err(err)
} else {
Ok(())
@@ -71,7 +71,7 @@ impl ChildKiller for WinChildKiller {
fn kill(&mut self) -> IoResult<()> {
let res = unsafe { TerminateProcess(self.proc.as_raw_handle() as _, 1) };
let err = IoError::last_os_error();
if res != 0 {
if res == 0 {
Err(err)
} else {
Ok(())