Skip to content

Commit a1a54ca

Browse files
committed
benchmark: terminate child process on Windows
test-benchmark-child-process failures reveal that child-process-exec-stdout benchmark sometimes leaves around a stray yes.exe process. Add code to terminate the process. PR-URL: #12658 Ref: #12560 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d8f8096 commit a1a54ca

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

benchmark/child_process/child-process-exec-stdout.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const bench = common.createBenchmark(main, {
1010
dur: [5]
1111
});
1212

13-
const exec = require('child_process').exec;
13+
const child_process = require('child_process');
14+
const exec = child_process.exec;
1415
function main(conf) {
1516
bench.start();
1617

@@ -29,7 +30,12 @@ function main(conf) {
2930
});
3031

3132
setTimeout(function() {
32-
child.kill();
3333
bench.end(bytes);
34+
if (process.platform === 'win32') {
35+
// Sometimes there's a yes.exe process left hanging around on Windows...
36+
child_process.execSync(`taskkill /f /t /pid ${child.pid}`);
37+
} else {
38+
child.kill();
39+
}
3440
}, dur * 1000);
3541
}

test/sequential/sequential.status

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ prefix sequential
77
[true] # This section applies to all platforms
88

99
[$system==win32]
10-
test-benchmark-child-process : PASS,FLAKY
1110

1211
[$system==linux]
1312

0 commit comments

Comments
 (0)