From 8afe0ad30739c5aa106c19e8a75b1dfc83bcfb56 Mon Sep 17 00:00:00 2001 From: Xuntao Chi Date: Sun, 7 Jun 2026 15:24:27 +0800 Subject: [PATCH] pty: windows: fix kill() (#7709) Fix inverted logic when considering the return value from the TerminateProcess call. --- pty/src/win/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pty/src/win/mod.rs b/pty/src/win/mod.rs index 24f8f5369..750f66975 100644 --- a/pty/src/win/mod.rs +++ b/pty/src/win/mod.rs @@ -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(()) -- 2.51.2