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

Console color doesn't reset after error when output is redirected #13979

Closed
scabana opened this issue Jun 16, 2020 · 7 comments
Closed

Console color doesn't reset after error when output is redirected #13979

scabana opened this issue Jun 16, 2020 · 7 comments
Assignees
Labels
Core CLI core infrastructure customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Milestone

Comments

@scabana
Copy link

scabana commented Jun 16, 2020

Describe the bug

After some errors, console color doesn't reset. This is similar to #6080.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

For example, but not limited to this example:

  1. az login
  2. wait for token expire
  3. az keyvault secret list --vault-name somekeyvault
  4. az prints: Get Token request returned http error: 400 and server response: {"error":"interaction_required","error_description":"AADSTS50078: Presented multi-factor authentication has expired due to policies configured by your administrato...
  5. echo Hey
  6. "Hey" is now red

Expected Behavior

Console color resets to original color.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Installer: MSI

azure-cli 2.6.0 *

Extensions:
aks-preview 0.4.50
azure-devops 0.18.0

Additional Context

❯ $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 16, 2020
@yonzhan yonzhan added the Core CLI core infrastructure label Jun 16, 2020
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Jun 16, 2020
@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jun 16, 2020
@yonzhan yonzhan added this to the S172 milestone Jun 16, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Jun 16, 2020

add to S172

@jiasli
Copy link
Member

jiasli commented Jun 17, 2020

Hi @scabana, are you redirecting the result of az keyvault secret list --vault-name somekeyvault to somewhere else? If so, the only fix is to manually disable color (introduced in #12601) following CLI configuration values and environment variables with the no_color config.

This is a bug with colorama (tartley/colorama#200) out of our control.

@scabana scabana changed the title Console color doesn't always reset after error Console color doesn't reset after error when output is redirected Jun 17, 2020
@scabana
Copy link
Author

scabana commented Jun 17, 2020

Hi,

It's exactly that. I'll rename the issue. Should this issue be kept opened until a proper fix can be provided?

@yonzhan yonzhan added the Service Attention This issue is responsible by Azure service team. label Jun 17, 2020
@jiasli
Copy link
Member

jiasli commented Jun 18, 2020

Yes. The fix microsoft/knack#209 is on its way!

@jiasli jiasli modified the milestones: S172, S173 Jul 9, 2020
@yonzhan yonzhan modified the milestones: S173, Backlog Jul 11, 2020
@azure-sdk azure-sdk added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Sep 24, 2020
@czmirek
Copy link

czmirek commented Jan 4, 2021

Got similar issue with az pipelines variable-group list

image

@jiasli
Copy link
Member

jiasli commented Jan 5, 2021

@czmirek, this is definitely caused by the colorama bug which is triggered by redirecting the stdout to ConvertTo-Json. microsoft/knack#209 has been merged and the next version of CLI 2.18.0 released by S181 at 2020-01-19 will get rid of this issue.

@jiasli jiasli marked this as a duplicate of #6080 Jan 20, 2021
@jiasli jiasli closed this as completed Jan 20, 2021
@jiasli
Copy link
Member

jiasli commented Jan 20, 2021

This issue has been fixed. Please see #6080 (comment) for the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core CLI core infrastructure customer-reported Issues that are reported by GitHub users external to the Azure organization. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

5 participants