-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Disabling colored output requires convoluted cargo test --color=never -- --color=never
incantation
#1983
Comments
On cargo 0.5.0 2015-09-04 (the one distributed with current nightly), the correct incantation seems to be
Perhaps |
Thanks @durka! I can confirm that works. I will update the title of the issue because |
cargo test
cargo test --color=never -- --color=never
incantation
While I think this should probably apply to all invocations of I think a better solution may be for the test harness and Cargo to agree on an environment variable to disable or enable colorization or some other method not involving an extra argument. |
There is already |
Sounds pretty reasonable to me! |
@alexcrichton though... were you thinking this env var would disable color in other Cargo modes, as well? Like building and doc-ing? |
The way I see it, there are two orthogonal-ish questions:
|
So to start out with I was just thinking that whenever Cargo executed a test binary it would set this environment variable according to the flags passed to Cargo itself, but there's certainly a broader question of if there's an environment variable everyone can agree on to control this aspect. One has been proposed in rust-lang/rust#27867, for example. |
As there hasn't been any activity here in a while would someone (the author, a team member, or any interested party) be able to summarise the current state, perhaps making explicit:
Thank you! (The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.) If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable! |
As I didn't see any updates in 30 days I'm going to close this. Please see the previous comment for more information! |
I think this could probably stay open. I think there is an open question of forwarding flags to libtest, and how to handle other test harnesses (as being discussed in #6358 and #4325). In particular, the following are also awkward:
It might be a good idea to forward flags to libtest. But it would also be good to handle other harnesses, which isn't so straightforward. Environment variables are another option, which circumvents the issue of other harnesses not understanding the command-line (they would just be ignored). |
For #5609, I am looking at changing how cargo and libtest interact, with cargo taking more control over the rendering of output which would mean cargo will be showing the colored output, instead of libtest, resolving this issue. |
EDIT: see durka's comment below
It seems that there is no way to disable the colored output of
cargo test
. This is a nice thing to have when displaying output on e.g. CI sites that do not support ASCII escape codes.Combinations I tried blindly that didn't work include:
cargo test --no-color
cargo test -- --no-color
cargo test --color
cargo test -- --color
cargo test --color never
Also checked output of
cargo -h
andcargo test -h
but saw nothing.The text was updated successfully, but these errors were encountered: