-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[CORE-16] [Bug] Uncolored stdout when using the --use-colors
flag
#4443
Comments
@jbonatakis Thanks for the report, and thanks for upgrading to v1.0 so quickly! I'm seeing colorized output when I use There are two possibilities here:
A few ways to dig into this:
|
@jtcohen6 Thanks for the suggestions!
If I rebuild my image using v0.21.0 and run the same command I get colored output, but oddly enough there are no color tags in the Console (v0.21.0): When I run v1.0.0.0 with the This seems like an encoding issue. My Dockerfile is based on |
I've noticed something similar
You'll get color in the terminal Whereas,
You'll get no color because it's not a tty? The I'm running this in a regular terminal, with color output working in all other places (other CLI programs). |
In our case, we would like colors to be output even if we're piping to another program vs piping out into a terminal's output. The For example, |
I haven't had a chance to dig further into this, but just want to drop a few quick notes:
@nathaniel-may Sounds like we should add a spike for this to the list for #4441 |
But my concern is about piping and sub shells (specifically we're invoking dbt from another application) and we're no longer seeing color in the stdout of dbt in such cases. |
I get color output if I cat |
--use-colors
flag--use-colors
flag
It looks like docker's default shell does not understand 16-bit unicode-encoded escape sequences, namely: ReproductionOpen the docker cli and run the following two commands:
ansi: (is green, no escape sequences)
WorkaroundFrom your host machine (not the docker cli) you can run the following command which will open a new shell which does understand unicode escape sequences the way dbt v1.0.0 is emitting them:
SolutionAlthough unicode escape sequences are part of a good standard that has been around a very long time, they are unfortunately not supported by some modern and commonly used shells. For compatibility reasons we should revert to using the older ANSI encoding. |
It looks like it's non-trivial to revert escape sequences via our color library while also maintaining windows support for color. I'm closing this ticket because there is a workaround. |
Is there an existing issue for this?
Current Behavior
When running models via the CLI with the
--use-colors
flag, the output is still uncolored.dbt --use-colors run --select <models>
Expected Behavior
I would expect the output to be colored.
Steps To Reproduce
Running dbt via the CLI, execute:
dbt --use-colors run --select <models>
Relevant log output
No response
Environment
What database are you using dbt with?
bigquery
Additional Context
I am running this in a Docker container via a shell script and the full command, including Docker commands, is:
where the values passed ("$@") are
dbt --use-colors run --select <models>
If I rebuild my image using dbt v0.21.0 then the same command results in colored output.
The text was updated successfully, but these errors were encountered: