Skip to content

Commit

Permalink
fixup! test: add spawnSyncAndExit() and spawnSyncAndExitWithoutError()
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Aug 17, 2023
1 parent 67487fe commit 6d68d98
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/common/child_process.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const assert = require('assert');
const { spawnSync } = require('child_process');
const { spawnSync, execFileSync } = require('child_process');
const common = require('./');
const util = require('util');

Expand All @@ -15,14 +15,13 @@ function cleanupStaleProcess(filename) {
process.once('beforeExit', () => {
const basename = filename.replace(/.*[/\\]/g, '');
try {
require('child_process')
.execFileSync(`${process.env.SystemRoot}\\System32\\wbem\\WMIC.exe`, [
'process',
'where',
`commandline like '%${basename}%child'`,
'delete',
'/nointeractive',
]);
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.
}
Expand Down

0 comments on commit 6d68d98

Please sign in to comment.