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

No colors in task terminal #155444

Closed
skarasov opened this issue Jul 17, 2022 · 10 comments
Closed

No colors in task terminal #155444

skarasov opened this issue Jul 17, 2022 · 10 comments
Assignees
Labels
confirmation-pending info-needed Issue requires more information from poster tasks Task system issues terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc.

Comments

@skarasov
Copy link

Issue Type: Bug

Simple c code.
Run build task with clang or cl.
In task terminal no colored output, but in ordinary terminal all fine.
xolor

VS Code version: Code 1.69.1 (b06ae3b, 2022-07-12T08:21:24.514Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No

Extensions (3)
Extension Author (truncated) Version
cmake-tools ms- 1.11.26
cpptools ms- 1.10.8
cmake twx 0.0.17

(1 theme extensions excluded)

@meganrogge
Copy link
Contributor

the one without color is an extension contributed terminal. you can file an issue with the C/C+ extension about this

@meganrogge meganrogge added the *caused-by-extension Issue identified to be caused by an extension label Jul 25, 2022
@vscodenpa
Copy link

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@skarasov
Copy link
Author

Please, note:
microsoft/vscode-cpptools#9643

@Colengms
Copy link
Contributor

Colengms commented Aug 1, 2022

@meganrogge Note that this is not caused by the extension. Rather, something VS Code is doing with the task terminal is preventing compilers (gcc and clang) from detecting that they are in a shell terminal, causing them to disable colorized output. We can work around the problem by passing command line arguments that force gcc and clang (separately) to enable colorized output. However, the underlying issue is with VS Code. Please consider re-opening and addressing the issue in VS Code.

@meganrogge meganrogge reopened this Aug 1, 2022
@meganrogge meganrogge removed the *caused-by-extension Issue identified to be caused by an extension label Aug 1, 2022
@meganrogge
Copy link
Contributor

@Colengms thanks for the info. I'm not very familiar with how gcc and clang work, but what are those using to detect that they are in a shell terminal? environment variables?

@meganrogge meganrogge added bug Issue identified by VS Code Team member as probable bug tasks Task system issues confirmation-pending terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc. labels Aug 2, 2022
@Colengms
Copy link
Contributor

Colengms commented Aug 2, 2022

The code for gcc and clang are available online.

For GCC, I see: https://code.woboq.org/gcc/gcc/diagnostic-color.c.html
It looks like GetConsoleMode() and isatty() are being used to detect the terminal capabilities.

For Clang, I'm not sure. I just did a quick search, and see similar functionality in:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Windows/Process.inc
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Unix/Process.inc
i.e. Calls to GetConsoleMode() and isatty() in FileDescriptorIsDisplayed

@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2022

@Colengms can you link where cppbuild type tasks launch the shell?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Aug 3, 2022
@Tyriar Tyriar self-assigned this Aug 3, 2022
@Tyriar Tyriar added this to the August 2022 milestone Aug 3, 2022
@Colengms
Copy link
Contributor

Colengms commented Aug 3, 2022

Hi @Tyriar . It looks like cpptools is calling spawn to create this process, so the cause is indeed in cpptools. You can close this issue.

It looks like the correct solution is for cpptools to use node-pty (which VS Code uses internally) to spawn a process with a pseudo-terminal. It looks like that would require us to always build the TypeScript component on the target platform, which we're not currently doing. I'm tracking that with: microsoft/vscode-cpptools#9681

@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2022

@Colengms I'm not too familiar with how tasks interact with extensions, is it possible to launch a regular shell terminal instead? I think this is how the npm tasks would work since they have color

@Tyriar Tyriar closed this as not planned Won't fix, can't repro, duplicate, stale Aug 3, 2022
@roblourens
Copy link
Member

Nothing to verify?

@Tyriar Tyriar removed the bug Issue identified by VS Code Team member as probable bug label Aug 24, 2022
@Tyriar Tyriar removed this from the August 2022 milestone Aug 24, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmation-pending info-needed Issue requires more information from poster tasks Task system issues terminal-process Problems launching processes, managing ptys, exiting, process leaks, etc.
Projects
None yet
Development

No branches or pull requests

6 participants