Skip to content

Commit 780fa39

Browse files
Trottevanlucas
authored andcommitted
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 <[email protected]> Reviewed-By: Bartosz Sosnowski <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e8ae4ba commit 780fa39

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

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

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

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)