On Wed, 6 Aug 2025 08:21:13 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:
>> The teardown of a Process launched by `ProcessBuilder` includes the closing >> of streams and ensuring the termination of the process is the responsibility >> of the caller. The `Process.close()` method provides a clear and obvious way >> to ensure all the streams are closed and the process terminated. >> >> The try-with-resources statement is frequently used to open streams and >> ensure they are closed on exiting the block. By implementing >> `AutoClosable.close()` the completeness of closing the streams and process >> termination can be done by try-with-resources. >> >> The actions of the `close()` method are to close each stream and destroy the >> process if it has not terminated. > > src/java.base/share/classes/java/lang/snippet-files/ProcessExamples.java line > 38: > >> 36: Paddling with the river flow; >> 37: Chilling still, go slow. >> 38: """; > > Nit: I'm not against Haiku, though `writer.write("Hello, world!");` can be > enough to get the message across and save the reader (and the maintainer) 6 > LoC. True, maybe too clever, but It should be more than 1 line. Hello world can be quite boring after 30 years. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26649#discussion_r2257423663