Closed Bug 1798434 Opened 3 years ago Closed 3 years ago

Weird ANSI escape strings in mozphab output after upgrading to 1.2.1

Categories

(Conduit :: moz-phab, defect)

Production
x86_64
Windows 10
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: aminomancer, Unassigned)

References

Details

I'm using MozillaBuild on Windows 10. Just went to submit a patch and mozphab automatically upgraded from 1.1.0 to 1.2.1. It seems to have worked, but immediately after it finished upgrading, something went wrong with character encoding. I guess it's the little spinners. They seem to permanently deposit ANSI escape codes in the output, but as strings. Kinda weird since all my terminals definitely support ANSI escapes, I use them all the time in node.

$ moz-phab
moz-phab called without arguments; falling back to submit
Determining the commit range using upstream "origin"
←[K←[34mSubmitting 1 commit for review←[0m
(New) 8e426f16049f Bug 1795288 - Feature Callouts: add dismiss telemetry. r=mviar
←[K←[33mSubmit to https://phabricator.services.mozilla.com←[0m (YES/No/Always)? no

I initially noticed this in VS Code's integrated terminal, but then I tested it in Windows Terminal, then in cmd.exe. It's the same everywhere. I haven't tested on macOS or Linux yet.

So I went digging through the config file and found ui.no_ansi = False. I don't know what it was before. But setting it to True fixed the encoding issue. The spinners are showing as they did before the update.

Here's what my log says, FWIW:

2022-10-31 18:10:47,673 DEBUG    MozPhab (1.1.0)
2022-10-31 18:10:47,859 DEBUG    Versions - local: 1.1.0, PyPI: 1.2.1
2022-10-31 18:10:47,859 DEBUG    updating C:\Users\shmed\.moz-phab-config
2022-10-31 18:10:47,860 INFO     Upgrading to version 1.2.1
2022-10-31 18:10:47,976 DEBUG    $ 'C:\mozilla-build\python3\python3.exe' -m pip install MozPhab --upgrade --no-cache-dir --disable-pip-version-check
2022-10-31 18:10:49,356 INFO     Restarting...
2022-10-31 18:10:49,621 DEBUG    MozPhab (1.2.1)

This was an intentional change from Bug 1797367, albeit the landing may be a bit premature. The upcoming MozillaBuild 4.0.2 release will correctly interpret ANSI escape sequences and allow colored text to be displayed correctly in the console.

After the upgrade, if you're not using MozillaBuild, you can set the NO_ANSI environment variable and it will not output the ANSI escape sequences at all.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.