-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colors not displayed when child process output is piped #127
Comments
@bcaudan when you spawn your script, include an argument for colors.js is set to automatically detect if it is on a TTY, if it's being piped it assumes no and strips out colors. |
In my real use case (see referenced issue), I don't have control on how the script is spawn. Is there a way to force it programatically? |
OK, I figured it out. I can set the var colors = require('colors');
colors.enabled = true; And then colors are displayed! Thanks for your help @derrickpelletier. |
colors detects if it's a child process and disables colors. We now force them. See Marak/colors.js#127
colors detects if it's a child process and disables colors. We now force them. See Marak/colors.js#127
Thank godness! I believed that it's the shelljs(child process module)'s problem. I had no idea of the required argument |
anyone know how to do this with bash? in my child process, I have they colors/styling show up in the child, but when the parent inherits the stdout, the colors don't show up. |
You can try setting this env variable: |
Hi,
It seems that colors.js does not work when a child process output is piped.
For example, if I try to execute this code:
With this runner:
Only the first line is in red.
But if I change the stdio option to 'inherit' then both lines are in red.
Is there a way that colors.js also works when output is piped?
The text was updated successfully, but these errors were encountered: