mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: ignore stale process cleanup failures on Windows
In some tests we try to clean up stale child processes on Windows, but they don't necessarily exist, in that case we should ignore any failures from the WMIC.exe command. PR-URL: https://github.com/nodejs/node/pull/44480 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
f80bdc5ef3
commit
31f809acca
1 file changed
+12
-8
@@ -12,14 +12,18 @@ function cleanupStaleProcess(filename) {
|
||||
}
|
||||
process.once('beforeExit', () => {
|
||||
const basename = filename.replace(/.*[/\\]/g, '');
|
||||
require('child_process')
|
||||
.execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [
|
||||
'process',
|
||||
'where',
|
||||
`commandline like '%${basename}%child'`,
|
||||
'delete',
|
||||
'/nointeractive',
|
||||
]);
|
||||
try {
|
||||
require('child_process')
|
||||
.execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [
|
||||
'process',
|
||||
'where',
|
||||
`commandline like '%${basename}%child'`,
|
||||
'delete',
|
||||
'/nointeractive',
|
||||
]);
|
||||
} catch {
|
||||
// Ignore failures, there might not be any stale process to clean up.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user