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 output shows control characters #3278

Closed
JorritSalverda opened this issue Sep 18, 2015 · 10 comments
Closed

Console output shows control characters #3278

JorritSalverda opened this issue Sep 18, 2015 · 10 comments

Comments

@JorritSalverda
Copy link

In Windows, whether I use the command prompt, powershell or bash weird control characters show up in the output when running terraform:

←[0m
←[0m←[1mPlan:←[0m 0 to add, 1 to change, 0 to destroy.←[0m

@stack72
Copy link
Contributor

stack72 commented Sep 18, 2015

@JorritSalverda please can you add what version of terraform you are using

@JorritSalverda
Copy link
Author

$ terraform --version
Terraform v0.6.3

@JorritSalverda
Copy link
Author

Just found the -no-color option. Can I somehow make this permanent so I don't have to set it each time?

@stack72
Copy link
Contributor

stack72 commented Sep 18, 2015

@JorritSalverda on OSX I use a makefile so I guess you could use a .bat / .ps file on windows and have it set in there

@JorritSalverda
Copy link
Author

No environment variables like with packer? See https://www.packer.io/docs/other/environmental-variables.html#PACKER_NO_COLOR

@apparentlymart
Copy link
Contributor

Given that Windows has no support for VT100 escape codes, it seems like at least Terraform should just force colors off.

It looks like the Windows console doesn't have any equivalent way to embed color codes in-band in the output stream and instead requires functions to be called between writes to the console, so actually supporting colors on Windows would probably require some more significant refactoring.

Perhaps it's reasonable to have a special version of Meta.Colorize for Windows builds, which just forces on the Disable flag regardless of what's set on the command line. Then the -no-color flag could be documented as having no effect on Windows, though I think I'd still leave it accepted so it's easier to share wrapper scripts between Linux and Windows.

@jen20
Copy link
Contributor

jen20 commented Mar 18, 2016

Fixed in #5718.

@jen20 jen20 closed this as completed Mar 18, 2016
@kwcrook
Copy link

kwcrook commented Jan 31, 2018

This is not all fixed. We're still seeing this in v0.11.2 on vanilla powershell/command prompt but using ConEmu is a suitable workaround.

@apparentlymart
Copy link
Contributor

Hi @IDT-kcrook!

This was fixed by making the Windows build filter all output through a post-processor that parses VT100 escape sequences and translates them into equivalent calls to the Windows console API.

This special handling only applies to the windows_amd64 and windows_386 builds, so in particular doesn't apply when the Linux build of Terraform is run inside "Windows Subsystem for Linux" on Windows 10.

If you're running one of the native Windows builds and yet still seeing this problem in the built-in Windows shell, please open a new issue and fill out the new issue template so we can try to figure out what's happened here... the fix here went out in v0.6.14, and there were further improvements from #14194 released in v0.9.5, so it's likely that the issue you're seeing has a different root cause than this original report.

@apparentlymart apparentlymart added cli and removed core labels Jan 31, 2018
@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants