8

I'm using chalk to colour the output from from my command-line node application. Normally like this:

console.log(chalk.red(error));

However, I need to pipe stdout from a child process, and colour this output too:

var child = childProcess.spawn('foo', args);
child.stdout.pipe(process.stdout); //how to use chalk to colour this?

How do I use chalk to apply a colour when piping stdout in from a child process?

mtmacdonald
  • 14,216
  • 19
  • 63
  • 99
  • What kind of color? Just color *everything* a single set of colors? If you need to do selective coloring, you're going to have to write some middleware for it. If you're wanting to have the child process output its colors, that's an [entirely different problem](http://stackoverflow.com/questions/3515208/can-colorized-output-be-captured-via-shell-redirect) unrelated to chalk. – Qix - MONICA WAS MISTREATED Jul 31 '15 at 20:06

0 Answers0