test: try fixing windows build replacing WMIC

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65949
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
This commit is contained in:
James M Snell authored and GitHub committed 2026-09-10 15:19:13 +00:00
1 parent 47f814137d
commit bb79acaae8
1 file changed
+6 -6
+6 -6
View File
@@ -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.