On Wed, 2 Jul 2025 14:52:06 GMT, Roger Riggs <[email protected]> wrote:
>> Improve the documentation of Process use of system resources.
>>
>> Describe the implementation closing streams when no longer referenced.
>> Clarify the interactions between inputStream and inputReader and errorStream
>> and errorReader.
>> Add advice and example using try-with-resources to open and close streams.
>> Recommend closing streams when no longer in use.
>
> Roger Riggs has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Fix links per review comments and snippet syntax in
> ProcessBuilder.Redirect.DISCARD.
src/java.base/share/classes/java/lang/Process.java line 113:
> 111: * releasing the operating system resources.
> 112: * {@code Try-with-resources} can be used to open and close the streams.
> 113: * <p>For example, to capture the output of a program known to produce
> some output and then exit:
Hello Roger, co-incidentally, I was experimenting with the `Process` APIs in a
different area. The code snippet that we recommend here will only capture the
standard output of the invoked process. Although the sentence here says
"output" of a program, do you think we should make it more clearer that it's
the standard output of the program? Arguably, since the snippet already uses
`inputReader()` whose javadoc notes that it represents the standard output,
then maybe the additional clarification isn't needed?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2182579944