On Fri, 27 Jun 2025 16:02:45 GMT, Jaikiran Pai <j...@openjdk.org> 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.
>
> src/java.base/share/classes/java/lang/Process.java line 116:
> 
>> 114:  * Closing a stream at either end terminates communication but does not 
>> have any direct effect
>> 115:  * on the other Process. Typically, the other process responds to the 
>> closing of the stream
>> 116:  * by exiting.
> 
> Hello Roger, the way I read that last sentence, it gives an impression that 
> if `ProcessBuilder` was used to launch a `Process` from within the current 
> Java process, then if the invoked process' stream is closed, then the current 
> Java process exits. Do you think it should be reworded to avoid any confusion?

I thought it was clear that "the other process... exits". But I'll try a 
different variation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2172486849

Reply via email to