From bb79acaae854feb01e7ecc6db752005b8eb548b0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 10 Sep 2026 08:19:13 -0700 Subject: [PATCH] test: try fixing windows build replacing WMIC Signed-off-by: James M Snell PR-URL: https://github.com/nodejs/node/pull/65949 Reviewed-By: Filip Skokan Reviewed-By: Stefan Stojanovic --- test/common/child_process.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/common/child_process.js b/test/common/child_process.js index c74154bb084..59505e5824d 100644 --- a/test/common/child_process.js +++ b/test/common/child_process.js @@ -15,12 +15,12 @@ function cleanupStaleProcess(filename) { process.once('beforeExit', () => { const basename = filename.replace(/.*[/\\]/g, ''); try { - execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [ - 'process', - 'where', - `commandline like '%${basename}%child'`, - 'delete', - '/nointeractive', + execFileSync(`${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, [ + '-NoProfile', + '-NonInteractive', + '-Command', + `Get-CimInstance Win32_Process -Filter "CommandLine LIKE '%${basename}%child'" | ` + + 'ForEach-Object { Stop-Process -Id $_.ProcessId -Force }', ]); } catch { // Ignore failures, there might not be any stale process to clean up.