Skip to content
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

Missing chalk colors from child process #21

Open
TysonMN opened this issue Jun 11, 2020 · 9 comments
Open

Missing chalk colors from child process #21

TysonMN opened this issue Jun 11, 2020 · 9 comments
Labels
bug Something isn't working minor This is a minor issue. pending on external library this issue is pending on another issue/PR of an external library

Comments

@TysonMN
Copy link
Contributor

TysonMN commented Jun 11, 2020

This is a spin off from issue #17

Quoting #17 (comment)

2020-06-09_21-01-29_119_mintty

On the topic of error messages, where are those beautiful colors? My error message doesn't have any red in it :(

I am using Windows. I use GitKraken to launch a terminal. It opens Mintty 2.9.6.

There are many colors just above each prompt...
2020-06-10_22-29-01_123_mintty

...but not for error messages from codedoc.

@loreanvictor loreanvictor added the bug Something isn't working label Jun 11, 2020
@loreanvictor
Copy link
Contributor

@bender2k14 it would be really great if you could clone the cli code locally and investigate this issue a bit further. this should be particularly related to this part of the CLI code.

@loreanvictor
Copy link
Contributor

@bender2k14 p.s. tested on Windows 7 default Command Prompt and the colors are working relatively fine (the color palette seems to be more limited). could you also test on the Command Prompt and see if you do not see any colors?

P.S. perhaps this is related to this issue?

@TysonMN
Copy link
Contributor Author

TysonMN commented Jun 11, 2020

...could you also test on the Command Prompt and see if you do not see any colors?

Here is the standard Windows Command Prompt. There are some green #, but no red in the error message.

2020-06-11_09-04-57_125_cmd

@TysonMN
Copy link
Contributor Author

TysonMN commented Jun 11, 2020

@bender2k14 it would be really great if you could clone the cli code locally and investigate this issue a bit further. this should be particularly related to this part of the CLI code.

Absolutely.

What makes you think that code is related to this bug...what should I be looking for? I don't see anything there to do with color.

How can I test my changes? My best guess was to start by executing node index.js in the root of the repo, but that didn't work. I know that I want to test executing a line of code like

console.log(chalk.red('# Not Found::'));

I just need a bit more direction since this is not my normal programming environment.

@loreanvictor
Copy link
Contributor

because thats the main utility function running sub-commands and piping their output to the standard output. colors disappearing means some form of transformation happening on the output of those sub-commands while being piped.

the way I typically test the CLI is to run it from the root of another codedoc project, testing out its various commands. something like this:

node ../codedoc-cli/src/index.js update

@TysonMN
Copy link
Contributor Author

TysonMN commented Jun 12, 2020

Lots of colors from these two commands, including a red error, from the Windows default Command Prompt. So red missing from errors for missing files when executing serve and all colors missing when using Mintty 2.9.6.

2020-06-11_19-16-24_126_cmd

@loreanvictor
Copy link
Contributor

So red missing from errors for missing files when executing serve

setting Mintty aside, based on what you describe it seems like logs from the main CLI process preserve color while logs from sub-processes don't. perhaps some information is being lost in these two lines?

@TysonMN
Copy link
Contributor Author

TysonMN commented Jun 12, 2020

Yes, I think you are right.

To summarize, these two lines pipe the output of a child process to the output of the parent process, but the colors don't come with. That is exactly issue #381 of chalk.

@TysonMN TysonMN changed the title Missing red color in error messages Missing chalk colors from child process Jun 12, 2020
@loreanvictor
Copy link
Contributor

Let's keep this issue open to monitor the state of that issue in chalk.

@loreanvictor loreanvictor added the pending on external library this issue is pending on another issue/PR of an external library label Jun 13, 2020
@loreanvictor loreanvictor added the minor This is a minor issue. label Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor This is a minor issue. pending on external library this issue is pending on another issue/PR of an external library
Projects
None yet
Development

No branches or pull requests

2 participants