visionmedia/node-progress

Progress bar doesn't show at child_process spawn

MikeDevice opened this issue · 2 comments

Here is two files

test.js

var ProgressBar = require('progress');

var bar = new ProgressBar(':bar', { total: 10 });

console.log('ProgressBar');
var timer = setInterval(function () {
  bar.tick();
  if (bar.complete) {
    clearInterval(timer);
  }
}, 100);

index.js

var spawn = require('child_process').spawn;

var ls = spawn('node', ['./test.js']);

ls.stdout.on('data', function(data) {
  console.log(data.toString());
});

If run $ node test.js , progress bar will be rendered, but if run $ node index.js — won't.

By default this writes to the stderr stream. Did you try stderr instead of stdout?

Progress bar uses by default as strem the stderr, check here.

Can you try using in options the standard output?

var bar = new ProgressBar(':bar', { total: 10, stream: process.stdout });