Skip to content

Commit

Permalink
benchmark: terminate child process on Windows
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott committed Apr 28, 2017
1 parent d8f8096 commit a1a54ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions benchmark/child_process/child-process-exec-stdout.js
Expand Up @@ -10,7 +10,8 @@ const bench = common.createBenchmark(main, {
dur: [5] dur: [5]
}); });


const exec = require('child_process').exec; const child_process = require('child_process');
const exec = child_process.exec;
function main(conf) { function main(conf) {
bench.start(); bench.start();


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


setTimeout(function() { setTimeout(function() {
child.kill();
bench.end(bytes); bench.end(bytes);
if (process.platform === 'win32') {
// Sometimes there's a yes.exe process left hanging around on Windows...
child_process.execSync(`taskkill /f /t /pid ${child.pid}`);
} else {
child.kill();
}
}, dur * 1000); }, dur * 1000);
} }
1 change: 0 additions & 1 deletion test/sequential/sequential.status
Expand Up @@ -7,7 +7,6 @@ prefix sequential
[true] # This section applies to all platforms [true] # This section applies to all platforms


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


[$system==linux] [$system==linux]


Expand Down

0 comments on commit a1a54ca

Please sign in to comment.