GeezerVison is showing github.com — [core] If report is written to stdout, stdout should not be closed · Issue #4031 · pmd/pmd
[core] If report is written to stdout, stdout should not be closed #4031
Labels
a:bugPMD crashes or fails to analyse a file. Description
Description:
Found in #4023 (comment) and #4023 (comment)
I've added a report output file as otherwise we report to stdout.
And we close the report files afterwards - which is why we close stdout.
We have a outStreamCaptor active, however, the close is delegated to the original stdout stream.
Closing stdout in a unit test is not good for IntelliJ IDEA, as IntelliJ IDEA uses this channel
to communicate test progress etc...
I think we should never close stdout,,, We should use something similar to https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/output/CloseShieldWriter.html
This might be a problem, when PMD is integrated as a library (e.g. just calling PMD.run(...)) and no report file given. Then PMD will write the report to stdout and close it afterwards... and the calling process now has a closed stdout.
Activity
added a commit that references this issue
on Jun 30, 2022This issue will close once commit 157e623 is merged into the 'main' branch.157e623
Metadata
Metadata
a:bugPMD crashes or fails to analyse a file. Development
No branches or pull requestsIssue actions