Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions benchmark/child_process/child-process-exec-stdout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best way to do it, it seems so cruel 😭
Now seriously, child.kill should work, aren't we masking a real problem?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NM, yes.exe is a ported unix util, it's probably crazy

} else {
child.kill();
}
}, dur * 1000);
}