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

Simplify color processing on Windows #1060

Merged
merged 1 commit into from
Nov 1, 2022
Merged

Conversation

ellismg
Copy link
Member

@ellismg ellismg commented Nov 1, 2022

Historically, the Windows console has used out of band signaling for control color information, unlike *nix where control characters are added to the text to control what color it is printed in and other formatting information.

For a long time, Windows could not cope with the *nix strategy, leading to things like colorable.NewColorableStdout() and friends which tried to provide streams which would interpret ANSI escape sequences and call the corresponding Win32 methods to change colors as it rendered the text.

This process was very fragile and would lead to cases where we'd end up not using colorable.NewColorableStdout() and then when run on windows in the legacy console host we'd see these escape codes get printed.

Windows now supports processing these escape sequences. Enable that behavior and get out of the colorable.NewColorableStdout() game.

Fixes #1058

Historically, the Windows console has used out of band signaling for
control color information, unlike *nix where control characters are
added to the text to control what color it is printed in and other
formatting information.

For a long time, Windows could not cope with the *nix strategy,
leading to things like `colorable.NewColorableStdout()` and friends
which tried to provide streams which would interpret ANSI escape
sequences and call the corresponding Win32 methods to change colors as
it rendered the text.

This process was very fragile and would lead to cases where we'd end
up not using `colorable.NewColorableStdout()` and then when run on
windows in the legacy console host we'd see these escape codes get
printed.

Windows now supports processing these escape sequences. Enable that
behavior and get out of the `colorable.NewColorableStdout()` game.

Fixes Azure#1058
@ellismg
Copy link
Member Author

ellismg commented Nov 1, 2022

Without these changes:

image

With these changes:

image

Note that if you were using Windows Terminal, you wouldn't have hit this issue, as it turns this behavior on by default.

@ellismg ellismg enabled auto-merge (squash) November 1, 2022 18:40
@azure-sdk
Copy link
Collaborator

Azure Dev CLI Install Instructions

Install scripts

MacOS/Linux

May elevate using sudo on some platforms and configurations

bash:

curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/uninstall-azd.sh | bash;
curl -fsSL https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/install-azd.sh | bash -s -- --base-url https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060 --version '' --verbose

pwsh:

Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/uninstall-azd.ps1' -OutFile uninstall-azd.ps1; ./uninstall-azd.ps1
Invoke-RestMethod 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/install-azd.ps1' -OutFile install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060' -Version '' -Verbose

Windows

powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/uninstall-azd.ps1' > uninstall-azd.ps1; ./uninstall-azd.ps1;"
powershell -c "Set-ExecutionPolicy Bypass Process; irm 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060/install-azd.ps1' > install-azd.ps1; ./install-azd.ps1 -BaseUrl 'https://azuresdkreleasepreview.blob.core.windows.net/azd/standalone/pr/1060' -Version '' -Verbose;"

Standalone Binary

Container

docker run -it azdevcliextacr.azurecr.io/azure-dev:pr-1060

@ellismg ellismg merged commit a0cac3d into Azure:main Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Strange formatting during resource provisioning.
3 participants