From a1a54ca3f1c55d3e7fb56fa566c98bc6c0a2dd9a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 25 Apr 2017 13:48:50 -0700 Subject: 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: https://github.com/nodejs/node/pull/12658 Ref: https://github.com/nodejs/node/issues/12560 Reviewed-By: Refael Ackermann Reviewed-By: Bartosz Sosnowski Reviewed-By: James M Snell --- benchmark/child_process/child-process-exec-stdout.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'benchmark/child_process') diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js index 6b9bebf347c..a30eb92f6ad 100644 --- a/benchmark/child_process/child-process-exec-stdout.js +++ b/benchmark/child_process/child-process-exec-stdout.js @@ -10,7 +10,8 @@ const bench = common.createBenchmark(main, { dur: [5] }); -const exec = require('child_process').exec; +const child_process = require('child_process'); +const exec = child_process.exec; function main(conf) { bench.start(); @@ -29,7 +30,12 @@ function main(conf) { }); setTimeout(function() { - child.kill(); 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); } -- cgit v1.2.3