RFR: 8354872: Clarify java.lang.Process resource cleanup [v4]
Roger Riggs
rriggs at openjdk.org
Thu Jul 3 14:25:43 UTC 2025
On Thu, 3 Jul 2025 11:46:32 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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?
`inputReader()` is specific as to the output of the sub-process and the example covers only the most common case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2182928151
More information about the core-libs-dev
mailing list