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 from child scripts not being used in logged output #86
Comments
Hi @kentcdodds! Thanks for the report. See:
You can, however, use the |
Ah! I found this which explains what's going on quite nicely. I think that a solution could be to simply add var spawnOpts = config.raw
? {stdio: 'inherit'}
: {
env: Object.assign({FORCE_COLOR: 1}, process.env)
}; I'd be happy to make a PR to do this! |
Hmm, yes, this makes more sense 😁 I think it's better if we don't force colors everytime. This way we can avoid strange ASCII chars in some cases. |
You can check if it's TTY and only force colors in this case. This solved CI and similar cases: https://github.com/okonet/lint-staged/blob/master/src/index.js#L18 |
We could just use https://www.npmjs.com/package/supports-color :) That's the same thing that chalk uses. var spawnOpts = config.raw
? {stdio: 'inherit'}
: {
env: Object.assign({FORCE_COLOR: Boolean(supportsColor)}, process.env)
}; |
Exactly what I thought 👍 If you have the time to send such PR, please go ahead. |
Writing tests for this is pretty difficult and would require a bit of a rewrite of how tests work. So I'm not going to add tests to my changes. |
Published v3.2.0! |
Using concurrently |
Hi @sinedied, unlikely to be a regression, maybe it's something in your environment. But please open a new issue so that I can help diagnose. |
Thanks for this tool! I think it's great! I'm not getting colorized output when running concurrently on a script that is outputing stuff with chalk. Here's a repo that reproduces the issue: https://github.com/kentcdodds/chalk-concurrently-bug
It's pretty simple.
color-red.js
is:Any ideas? This is sort of a blocker for
p-s
dropping the--parallel
option and recommending people just useconcurrently
. (more info).The text was updated successfully, but these errors were encountered: