Browse Source

benchmark: use 'yes' instead of echo in a loop

This changes child-process-exec-stdout benchmark to use 'yes' instead
of echo in a while loop. This makes this benchmark consistent with
child-process-read which already uses `yes` and allows this benchmark
to be executed on Windows.

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/nodejs/node/pull/8721
v6
Bartosz Sosnowski 8 years ago
parent
commit
d5bc52aa2e
  1. 3
      benchmark/child_process/child-process-exec-stdout.js

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

@ -20,8 +20,7 @@ function main(conf) {
const msg = `"${'.'.repeat(len)}"`; const msg = `"${'.'.repeat(len)}"`;
msg.match(/./); msg.match(/./);
const options = {'stdio': ['ignore', 'pipe', 'ignore']}; const options = {'stdio': ['ignore', 'pipe', 'ignore']};
// NOTE: Command below assumes bash shell. const child = exec(`yes ${msg}`, options);
const child = exec(`while\n echo ${msg}\ndo :; done\n`, options);
var bytes = 0; var bytes = 0;
child.stdout.on('data', function(msg) { child.stdout.on('data', function(msg) {

Loading…
Cancel
Save