RFR: 8233725: ProcessTools.startProcess() has output issues when using an OutputAnalyzer at the same time

Leonid Mesnik lmesnik at openjdk.org
Sun Apr 23 22:42:48 UTC 2023


ProcessTools.startProcess() creates process and read it's output error streams. So the any other using of corresponding Process.getInputStream() and Process.getErrorStream() doesn't get process streams.

This fix preserve process streams content and allow to read reuse the date. The ByteArrayOutputStream is used as a buffer. 
It stores all process output, never trying to clean date which has been read. 

The regression test has been provided with issue.

I closed previous PR https://github.com/openjdk/jdk/pull/13560 by mistake instead of updating it.

I run all tests to ensure that no failures are introduced.

-------------

Commit messages:
 - copyrights fixed
 - typo fixed
 - fixed to use buffer.
 - JStackStressTest.java updated.
 - 8233725: ProcessTools.startProcess() has output issues when using an OutputAnalyzer at the same time

Changes: https://git.openjdk.org/jdk/pull/13594/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13594&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8233725
  Stats: 210 lines in 3 files changed: 198 ins; 2 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/13594.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13594/head:pull/13594

PR: https://git.openjdk.org/jdk/pull/13594


More information about the core-libs-dev mailing list