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

ANSI characters appearing after setting the title #10104

Closed
trajano opened this issue May 17, 2021 · 10 comments
Closed

ANSI characters appearing after setting the title #10104

trajano opened this issue May 17, 2021 · 10 comments
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@trajano
Copy link

trajano commented May 17, 2021

Windows Terminal version (or Windows build number)

Microsoft Windows [Version 10.0.19042.985]

Other Software

'git' (2.31.1.windows.1) from scoop and using that as the Bash provider
'aws' (2.2.5) AWS CLI that this is having problems with

Steps to reproduce

When I do

aws logs tail --follow --region us-west-2 --since 0s my-cloudwatch-logs

I see the colors correctly, but when I set the title as follows

echo -ne "\033]0;☁ my-cloudwatch-logs \a" && aws logs tail --follow --region us-west-2 --since 0s my-cloudwatch-logs

The colors stop working and I see the ANSI escape codes.

This used to work before I reinstalled Windows

Expected Behavior

Colors should appear and not ANSI codes. Title should get set.

Actual Behavior

ANSI Codes are appearing. Title is getting set.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 17, 2021
@skyline75489
Copy link
Collaborator

By saying "colors" do you mean the colored output in the console? A screenshot would be nice.

@zadjii-msft
Copy link
Member

Also, does

echo -ne "\033]0;my-cloudwatch-logs \a" && aws logs tail --follow --region us-west-2 --since 0s my-cloudwatch-logs

work as expected?

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label May 17, 2021
@trajano
Copy link
Author

trajano commented May 17, 2021

direct has color
image

No color when setting the title
image

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 17, 2021
@zadjii-msft
Copy link
Member

Definitely another case of VT processing being disabled, though I don't know why this wouldn't work when preceeded by an echo. We've got a pile of these elsewhere on the repo, but this one seems different. I don't have any idea why the echo in the same commandline would disable this.

I wonder if

printf "\033]0;☁ my-cloudwatch-logs \a" && aws logs tail --follow --region us-west-2 --since 0s my-cloudwatch-logs

would work instead?

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels May 17, 2021
@trajano
Copy link
Author

trajano commented May 17, 2021

@zadjii-msft yup I was actually hesitant on creating another one, but this is a very weird and specific scenario. As for your scenario nope it did not work.

Here's something to narrow it down. I used true rather than echo and it worked as expected. So it may be something to do with the title or the ANSI sequence.

image

Actually echo X && .... and printf X also didn't work so it may be something to do with writing an output

sleep 1 && ... works correctly.

curl -L https://get.scoop.sh && ... also works correctly. so that disproves my hypothesis where it's because I had an output.

My hypothesis right now is anything that uses msys that generates an output will prevent this from working correctly.

So far the hypothesis is showing it because date && ... also does not work.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 17, 2021
@zadjii-msft
Copy link
Member

so this sounds like something that must have recently regressed in msys, between whatever version you had before you reinstalled windows and whatever's currently installed. Maybe this should get moved upstream?

@trajano
Copy link
Author

trajano commented May 17, 2021

It's actually the same version. But I had a fresh install of Windows so I am not sure.

image

@trajano
Copy link
Author

trajano commented May 17, 2021

Hypothesis confirmed I use powershell to execute. So it may be something in msys that git is using.

image

Except I can't seem to write out the escape sequence in powershell correctly.

@zadjii-msft
Copy link
Member

oh woah, this actually looks exactly like #9607, with a touch of #6634

@trajano
Copy link
Author

trajano commented May 17, 2021

@zadjii-msft the difference betweem #9607 and this is that aws actually processes the data now. But my comment in #6634 which points to starship/starship#2258 (comment) actually gave me the workaround I need

Basically I have to close off the stdin

(echo -ne "\033]0;☁ title  \a" < /dev/null)

image

Closing this for now since I have a workaround and it appears to be an upstream msys/cygwin issue @zadjii-msft feel free to re-open if you need to.

@trajano trajano closed this as completed May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

3 participants