hazendaz opened a new issue, #14018:
URL: https://github.com/apache/maven/issues/14018
### Affected version
3.10.1
### Bug description
<html><body>
<!--StartFragment--><h2><span>Title</span></h2><p><span>ANSI color detection
fails in PowerShell terminal launched through GitHub Desktop on Windows (Maven
3.10.1)</span></p><h2><span>Description</span></h2><p><span>After upgrading to
Maven 3.10.1, automatic ANSI color output no longer works in the PowerShell
terminal launched through GitHub Desktop.</span></p><p><span>This appears to be
related to the terminal detection changes introduced when JLine was removed in
Maven 3.10.1.</span></p><p><span>I have isolated the issue to the absence of
the </span><code><span>WT_SESSION</span></code><span> environment variable in
the PowerShell process launched through GitHub
Desktop.</span></p><h3><span>Environment</span></h3><ul><li><p><span>OS:
Windows 11 (latest available release)</span></p></li><li><p><span>Terminal:
Windows Terminal</span></p></li><li><p><span>Shell: PowerShell
7.6</span></p></li><li><p><span>GitHub Desktop:
3.6.10</span></p></li><li><p><span>JDK: OpenJDK 27</span></p></
li><li><p><span>Maven: 3.10.1</span></p></li></ul><h3><span>Steps to
reproduce</span></h3><ol start="1"><li><p><span>Launch a PowerShell terminal
through GitHub
Desktop.</span></p></li><li><p><span>Run:</span></p><pre><code><span>mvn
-version</span></code></pre></li><li><p><span>Observe that ANSI color output is
disabled.</span></p></li></ol><h3><span>Diagnostics</span></h3><p><span>The JVM
correctly identifies the console as an interactive
terminal:</span></p><pre><code><span>System.out.println(System.console());
System.out.println(System.console().isTerminal());</span></code></pre><p><span>Output:</span></p><pre><code><span>java.io.ProxyingConsole@31221be2
true</span></code></pre><p><span>The following environment variables are
absent in the failing
session:</span></p><ul><li><p><code><span>WT_SESSION</span></code></p></li><li><p><code><span>WT_PROFILE_ID</span></code></p></li><li><p><code><span>TERM</span></code></p></li><li><p><code><span>TERM_PROGRAM</span></code></p></li><li><p><code><span>ConEmuANSI</span></code></p></li><li><p><code><span>ANSICON</span></code></p></li></ul><p><span>However,
when PowerShell is launched normally through Windows Terminal, both
</span><code><span>WT_SESSION</span></code><span> and
</span><code><span>WT_PROFILE_ID</span></code><span> are
present.</span></p><h3><span>Confirmed workaround</span></h3><p><span>Setting
</span><code><span>WT_SESSION</span></code><span> manually in the failing
PowerShell session immediately restores automatic color
detection:</span></p><pre><code><span>$env:WT_SESSION = 'test'
mvn -version</span></code></pre><p><span>Maven now produces colored output
without requiring
</span><code><span>--color=always</span></code><span>.</span></p><h3><span>Additional
testing</span></h3><p><span>I tested the following environments on the same
Windows 11 machine:</span></p>
<table>
<thead>
<tr><th>Environment</th><th>ANSI color</th></tr>
</thead>
<tbody>
<tr><td>Windows Terminal with PowerShell 5.1</td><td>Works</td></tr>
<tr><td>Windows Terminal with PowerShell 7.6</td><td>Works</td></tr>
<tr><td>PowerShell 7.6 launched through GitHub
Desktop</td><td>Fails</td></tr>
<tr><td>Git Bash</td><td>Works</td></tr>
<tr><td>Command Prompt</td><td>Works</td></tr>
<tr><td>GitHub Desktop PowerShell with WT_SESSION manually
defined</td><td>Works</td></tr>
</tbody>
</table>
<p><span>Explicitly specifying
</span><code><span>--color=always</span></code><span> also works in the failing
environment.</span></p><h3><span>Expected behavior</span></h3><p><span>Maven
should correctly identify ANSI-capable Windows terminal sessions without
relying exclusively on the presence of specific environment
variables.</span></p><p><span>In this case, the JVM already identifies the
console as a valid terminal, but Maven subsequently applies additional
Windows-specific environment checks that disable
color.</span></p><h3><span>Additional context</span></h3><p><span>This
regression was introduced as part of the JLine removal in Maven
3.10.1.</span></p><p><span>The current detection logic explicitly checks for
</span><code><span>WT_SESSION</span></code><span> to identify Windows Terminal.
However, processes launched through GitHub Desktop do not necessarily inherit
this variable, even when the resulting PowerShell session is running in an
ANSI-capable terminal.</span></p><
p><span>Manually defining </span><code><span>WT_SESSION</span></code><span>
confirms that this is the specific detection condition preventing automatic
color output.</span></p><p><span>Would it be possible to improve Windows
terminal detection so that ANSI-capable terminals are recognized without
depending on </span><code><span>WT_SESSION</span></code><span> being
present?</span></p><p><span>This should also be covered by Windows terminal
detection tests, particularly for processes launched by other desktop
applications.</span></p><!--EndFragment-->
</body>
</html>
**Additional note:** I also tested launching Command Prompt through GitHub
Desktop and observed the same behavior. This confirms the issue is not specific
to PowerShell, but affects other shells launched through GitHub Desktop as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]