On Mon, 22 Sep 2025 22:25:59 GMT, Roger Riggs <[email protected]> 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.
>
> Roger Riggs has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update close() to use "terminate" consistently.

I just noticed that the GitHub action job failure looks related:


STARTED    jdk.java.lang.Process.ProcessCloseTest::testStreamsCloseThrowing ...
...
FileDescriptor.handle: 00000598
FileDescriptor.handle to close again and fail: 00000598
org.opentest4j.AssertionFailedError: Unexpected exception message ==> expected: 
<Bad file descriptor> but was: <The handle is invalid>
    at 
org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
    at 
org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
    at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
    at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
    at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1156)
    at 
jdk.java.lang.Process.ProcessCloseTest.testStreamsCloseThrowing(ProcessCloseTest.java:533)

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

PR Comment: https://git.openjdk.org/jdk/pull/26649#issuecomment-3346091852

Reply via email to