Skip to content

Commit bb79aca

Browse files
authored
test: try fixing windows build replacing WMIC
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #65949 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
1 parent 47f8141 commit bb79aca

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

test/common/child_process.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ function cleanupStaleProcess(filename) {
1515
process.once('beforeExit', () => {
1616
const basename = filename.replace(/.*[/\\]/g, '');
1717
try {
18-
execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [
19-
'process',
20-
'where',
21-
`commandline like '%${basename}%child'`,
22-
'delete',
23-
'/nointeractive',
18+
execFileSync(`${process.env.SystemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`, [
19+
'-NoProfile',
20+
'-NonInteractive',
21+
'-Command',
22+
`Get-CimInstance Win32_Process -Filter "CommandLine LIKE '%${basename}%child'" | ` +
23+
'ForEach-Object { Stop-Process -Id $_.ProcessId -Force }',
2424
]);
2525
} catch {
2626
// Ignore failures, there might not be any stale process to clean up.

0 commit comments

Comments
 (0)