From f332bcaf013b4908691f915079038f7cf5eb5d09 Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Wed, 21 Aug 2024 22:57:10 +0100 Subject: [PATCH] chore: terminate child processes on windows --- drivers/rust/driver/src/child_process.rs | 3 +++ drivers/rust/driver/src/plugin_manager.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/rust/driver/src/child_process.rs b/drivers/rust/driver/src/child_process.rs index cdea420e..326562cd 100644 --- a/drivers/rust/driver/src/child_process.rs +++ b/drivers/rust/driver/src/child_process.rs @@ -115,7 +115,10 @@ impl ChildPluginProcess { let mut s = System::new(); s.refresh_processes(); if let Some(process) = s.process(Pid::from_u32(self.child_pid as u32)) { + #[cfg(not(windows))] process.kill(); + #[cfg(windows)] + process::Command::new("taskkill.exe").arg("/PID").arg(child_pid.to_string()).arg("/F").arg("/T").output(); } else { warn!("Child process with PID {} was not found", self.child_pid); } diff --git a/drivers/rust/driver/src/plugin_manager.rs b/drivers/rust/driver/src/plugin_manager.rs index fff966d7..091f6e55 100644 --- a/drivers/rust/driver/src/plugin_manager.rs +++ b/drivers/rust/driver/src/plugin_manager.rs @@ -284,7 +284,10 @@ async fn start_plugin_process(manifest: &PactPluginManifest) -> anyhow::Result