iammerrick / grunt-parallel

Speed up your build by running commands and tasks in parallel!
MIT License
170 stars 24 forks source link

Added logging for concurrent tasks #12

Closed ChrisWren closed 11 years ago

ChrisWren commented 11 years ago

The grunt.utils.spawn function has an option for a child process to inherit the standard input and output of its parent process. By using this option, output from the child tasks will be logged in the terminal.

This is helpful for tasks like watch where you want to see what the task is outputting.

nh2 commented 11 years ago

+1 Severely needed! I can't see my coffee compilation errors and vogue messages!

guillaume86 commented 11 years ago

+1 It's usefull with long running tasks (watch/server)

iammerrick commented 11 years ago

Would love to merge this in if we could make it opt-in via an option?

boyanyordanov commented 11 years ago

I also needed this a few days back and added it to my local copy borrowing @ChrisWren's idea. I've just made a fork so you can check this commit if you want to see my approach: https://github.com/netoholic/grunt-parallel/commit/ef7985f6d709de118f74c55e2c6c11ff647f1c2d

Edit: I am pretty sure my solution is not universal, but it gets the job done for my use case. Running watch, server and a few other tasks.

iammerrick commented 11 years ago

Added support for this...

grunt.initConfig({
  stream: {
    options: {
      stream: true
    },
    tasks: [{ cmd: 'tail', args: ['-f', '/var/log/system.log']}]
  }
});

Thanks guys!

guillaume86 commented 11 years ago

Is it tested on windows? I get a "Warning: Cannot set property 'stdio' of undefined Use --force to continue." and I checked "task.opts" remain undefined even after the "task.opts = task.opts || {};".

iammerrick commented 11 years ago

@guillaume86 Could you post your parallel configuration?

guillaume86 commented 11 years ago

nothing fancy:

parallel:
  dev:
    #options: 
    #  stream: true
    grunt: true
    tasks: ['watch', 'server', 'reload']
iammerrick commented 11 years ago

For this version I moved the grunt option into the options hash... So change it too:

parallel:
  dev:
    options: 
      stream: true
      grunt: true
    tasks: ['watch', 'server', 'reload']
boyanyordanov commented 11 years ago

Great, I'll switch back to the official version.

guillaume86 commented 11 years ago

Thx, problem solved :)