On Fri, 21 Apr 2023 21:43:39 GMT, Leonid Mesnik <lmes...@openjdk.org> wrote:

> 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.

Marked as reviewed by cjplummer (Reviewer).

test/lib/jdk/test/lib/process/ProcessTools.java line 249:

> 247:         stdout.addOutputStream(out.getOutputStream());
> 248:         stderr.addOutputStream(err.getOutputStream());
> 249: 

Overall this looks good, although I'm a bit unclear on how some of the 
underpinnings work, allowing the output to appear in these output streams, and 
also in the LineForwarder output (above), and for that matter, in the 
lineConsumer output (below). I guess there is some multiplexing of the output 
that I just don't grasp, but appears to be something that already worked.

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

PR Review: https://git.openjdk.org/jdk/pull/13594#pullrequestreview-1398781718
PR Review Comment: https://git.openjdk.org/jdk/pull/13594#discussion_r1175775335

Reply via email to