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

Daniel D. Daugherty dcubed at openjdk.org
Tue Apr 25 15:53:00 UTC 2023


On Tue, 25 Apr 2023 04:05:05 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

>> test/lib/jdk/test/lib/process/ProcessTools.java line 792:
>> 
>>> 790:         @Override
>>> 791:         public InputStream getInputStream() {
>>> 792:             return out;
>> 
>> This is a little bit confusing that the `getInputStream()` returns `out` stream.
>> Just wanted to double-check if it is intentional and was not needed for `getOutputStream()` instead.
>
> Agree, it is confusing, even in standard j.l.Process API . The `InputStream java.lang.Process.getInputStream()`" returns **output** stream of started process.  So for our implementation ProcessImpl the 'out' and 'err' mean output and error streams. However they are returned as InputStreams so users could read them.

Right. From the API caller's POV, it is asking for InputStreams that it can use to read the process' stdout or stderr streams.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13594#discussion_r1176718448


More information about the serviceability-dev mailing list