diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-08-12 03:52:41 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-08-12 03:52:41 +0300 |
| commit | 3f752a72fdd073d875cf941e3049f9860e30d841 (patch) | |
| tree | ac0c62cb318b0c169a44e77928a886bd93c63ae8 /src/platform/windows.rs | |
| parent | 9ba32c25f37b15385295dfac0f539fcb434120f9 (diff) | |
fix: synchronously terminate cancelled status commands
Diffstat (limited to 'src/platform/windows.rs')
| -rw-r--r-- | src/platform/windows.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 12ed784e..83f85e6a 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -687,13 +687,22 @@ fn resume_suspended_process(process_id: Option<u32>) -> std::io::Result<()> { result } +impl StatusCommandGuard { + pub(crate) fn terminate(&mut self) { + if self.job != 0 { + // KILL_ON_JOB_CLOSE terminates the shell and every descendant still in + // the job, including on task cancellation and config reload. + unsafe { + CloseHandle(self.job as HANDLE); + } + self.job = 0; + } + } +} + impl Drop for StatusCommandGuard { fn drop(&mut self) { - // KILL_ON_JOB_CLOSE terminates the shell and every descendant still in - // the job, including on task cancellation and config reload. - unsafe { - CloseHandle(self.job as HANDLE); - } + self.terminate(); } } |
