Tuesday 14 March 2017

child_process and color

I'm trying to capture command output (using execa.shell) with color and am having limited success.If I force the command to use color (i.e. --color or similar) color is captured (like mocha). If the command doesn't support a --color option (like nyc) then output isn't colored.execa('command',{stdio: 'inherit'}) works fine. But ... I can't capture the output, it just gets pushed to my screen. I'd like to be able to capture the output.This has to be something about the filehandle or the environment that gets inherited vs what happens with a pipe. setting TERM worked for mocha (as it looks at the term to detect color), but it didn't work for nyc. This tells me that there's something else that needs to be synchronized when using pipe, but I can't for the life of me figure out what it is. Any thoughts?This answer didn't help. (I did get the inherit from it) http://ift.tt/19yk4m1

Submitted March 14, 2017 at 10:37PM by skarfacegc

No comments:

Post a Comment