gulp-multi-process icon indicating copy to clipboard operation
gulp-multi-process copied to clipboard

Question: How does it handle output?

Open purefan opened this issue 6 years ago • 3 comments

Hi!

One of the things I need to do is run webpack and watch for file changes, another I need to do is fire up dynamodb local, another one is to keep an electron app running... all of these spit out debugging information that I may need.

Ideally, I would use your plugin and combine all their output in one single stdout that I can prefix with an identifier:

[electron] debug from the app... [webpack] reloaded stuff [dynamodb] requested record X

is this something I can do with your plugin? (and if so, how?)

Thanks for your hard work!

purefan avatar May 02 '18 08:05 purefan

Hi!, sorry but currently you can't do it but maybe is possible to add the feature. I'm going to try these days to see if it's possible.

juanfran avatar May 05 '18 13:05 juanfran

Thanks @juanfran ! and again, thanks for all your work

purefan avatar May 07 '18 11:05 purefan

Hi! I haven't got an easy & clean solution to do this (yet¿), but I have an idea without changing this plugin.

function hook_stdout(message) {
  var old_write = process.stdout.write

  process.stdout.write = (function(write) {
      return function(string, encoding, fd) {
          arguments[0] = message + ': ' + arguments[0];
          write.apply(process.stdout, arguments);
      }
  })(process.stdout.write)

  return function() {
      process.stdout.write = old_write
  }
}

gulp.task('task1', function(cb) {
  hook_stdout('task example');
  
 // example gulp task
});

with this anything inside the task1 will log this "task example: example text from webpack plugin", this is what you need?

juanfran avatar May 10 '18 16:05 juanfran