RFR: 8294899: Process.waitFor() throws IllegalThreadStateException when a process on Windows returns an exit code of 259 [v2]

Roger Riggs rriggs at openjdk.org
Fri Nov 11 21:50:41 UTC 2022


On Thu, 10 Nov 2022 12:33:05 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> One final question - Now with this change, `Process.waitFor()` won't throw the `IllegalThreadStateException` for such programs that return `STILL_ACTIVE` exit code. However, looking at the code a subsequent Process.exitValue() call on that same process instance will still throw this exception. Should we be changing that too?

To fix that we'd have to find another Windows API to determine if the process had exited.
>From the Windows API description, `GetExitCodeProcess` seems to be the recommended way.

Also if `exitValue()` returned `STILL_ACTIVE` it would still be confusing to the program/programmer about whether the process had exited and where that exitValue came from.

I think the current Windows admonition about returning STILL_ACTIVE to "don't do that" is sufficient.

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

PR: https://git.openjdk.org/jdk/pull/10680


More information about the core-libs-dev mailing list