Repository navigation
[cli] Fix hanging PmdCliTest under Windows with git bash - #7344
Conversation
The progressbar uses JLine to determine the terminal width. Under Windows in git bash (PWD and MSYSTEM are set), JLine uses the exec terminal provider, which runs "tty.exe" with the inherited stdin of the forked surefire JVM. As surefire is reading from stdin (command channel) at the same time, tty.exe doesn't start until that read completes. This made PmdCliTest hang (locally) or take about 9.5 minutes (in the Windows CI build). This happened before and was worked around in d1d10d1 by adding "--no-progress" to the standard arguments of PmdCliTest. The test reportsSummaryAfterProgressBarWithReportFile (added with pmd#6823) needs the progress bar and doesn't use these standard arguments, so the problem came back. The tests don't need a real terminal, so disable the exec provider for all pmd-cli tests instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Btw. I was testing my local branch build (https://github.com/adangel/pmd/tree/wip/real-java-modules) under Windows and noticed, that the build is hanging in pmd-cli... I've now waited long enough, it took ~20 minutes vs. 10 seconds. How long it hangs seems to be a race between tty.exe and surefire. The timings of the last builds are 477, 518, 569, 589, 625 and 637 s for the test PmdCliTest. So, it was not always 9.5 minutes. |
|
No relevant source code has been changed, pmdtester skipped. (comment created at 2026-11-13 15:45:28+00:00 for 035fc85) |
UncleOwen
left a comment
There was a problem hiding this comment.
And now it's back to 1.6s. Thanks!
|
The build for this PR now says While the last build from main shows: Seems to be working, yes :) |
Describe the PR
PmdCliTesthangs under Windows when the build runs in git bash. In the Windows CI build itdoesn't hang forever but takes about 9.5 minutes:
Time elapsed: 568.8 s -- in PmdCliTest.The progressbar uses JLine to find out the terminal width. In git bash,
PWDandMSYSTEMare set, so JLine uses its exec terminal provider. That provider runs
tty.exewith theinherited stdin of the forked surefire JVM. Surefire reads its command channel from that
stdin at the same time, so
tty.exedoesn't start until that read completes. The thread dumpshows the
ProgressBarthread waiting inExecTerminalProvider.systemStreamName/ExecHelper.waitAndCapture.This happened before. In d1d10d1 it was worked around by
adding
--no-progressto the default arguments ofPmdCliTest. The testreportsSummaryAfterProgressBarWithReportFile(added with #6823) needs the progress bar anddoesn't use these arguments, so the problem came back.
This PR disables JLine's exec provider for all pmd-cli tests via the system property
org.jline.terminal.exec=false. The tests don't need a real terminal. Running PMD itself ingit bash isn't affected.
Related issues
Ready?
reportsSummaryAfterProgressBarWithReportFile)PmdCliTestshould take seconds instead of ~9.5 minutes)./mvnw clean verifypasses (checked by GitHub Actions)🤖 Generated with Claude Code