RFR: 8291986: ProcessBuilder.redirectErrorStream(true) leaves error stream available [v2]
Roger Riggs
rriggs at openjdk.org
Mon Jan 12 20:51:51 UTC 2026
> On Linux and Mac, when a process is started, pipes are created to communicate with the child.
> In the case where the stderr is redirected to stdout using `ProcessBuilder.redirectErrorStream()`, the pipe is not needed and should not be created.
>
> Added a test to check pipe creation when spawning with and without `redirectErrorStream(t/f)`.
> Rewrote the extraction of pipes to use `lsof` available on Mac and Linux. (previously used Linux /proc/pid/fd/...)
> Converted PipelineLeaksFD test to JUnit.
Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
Refactored invocation of `lsof` to not use pipes for I/O, using files instead.
It removes the possibility of side effects that might affect the checking of pipe usage.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/29143/files
- new: https://git.openjdk.org/jdk/pull/29143/files/c8b39e4a..83d03292
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=29143&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=29143&range=00-01
Stats: 28 lines in 1 file changed: 12 ins; 7 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/29143.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29143/head:pull/29143
PR: https://git.openjdk.org/jdk/pull/29143
More information about the core-libs-dev
mailing list