microsoft / tfs-cli

Cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services
MIT License
372 stars 132 forks source link

Error messages shown as solid red bars #465

Open mmaitre314 opened 2 months ago

mmaitre314 commented 2 months ago

Error messages are not readable, likely because they are printed as red text over a red background:

npx tfx-cli extension create --manifests does-not-exist.json

image

Disabling coloring with --no-color makes the error message appear:

npx tfx-cli extension create --manifests does-not-exist.json --no-color

image

polatengin commented 2 months ago

Hi @mmaitre314 ,

Can I kindly ask you to check your terminal settings? Do you have any theme, or formatting settings applied?

I try it on a few terminals, I couldn't repro the issue.

The error, and the message is thrown by the node itself when we try to read the file.

Node should be able to render the error message in correct formatting.

mmaitre314 commented 2 months ago

I am using the Windows command prompt which should be in plain-vanilla configuration. Looking at the code, in /app/lib/trace.ts it looks like console.error sets the foreground as red and colors.bgRed makes the background red, so this ends up being printed as red-over-red.

export function error(msg: any, ...replacements: printable[]): void {
    log("error: ", msg, colors.bgRed, replacements, console.error);
}

Quick test in the Node REPL:

image

polatengin commented 2 months ago

yes, I could repro the issue on my end, too 👍