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

ExE Boss duke at openjdk.org
Sun Oct 16 09:48:47 UTC 2022


On Wed, 12 Oct 2022 16:30:07 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Process.waitFor() throws IllegalThreadStateException when a process returns an exit code of 259.
> As described in the bug report, `waitFor()` should not be sensitive to the exit value.
> Previously, it erroneously threw IllegalStateException.
> Added a test to verify.

test/jdk/java/lang/ProcessBuilder/WindowsExitValue.java line 43:

> 41:         try {
> 42:             Process process = new ProcessBuilder("cmd", "/c", "exit /b 259").start();
> 43:             long exitValue = process.waitFor();

`Process.waitFor()` returns an `int`:
Suggestion:

            int exitValue = process.waitFor();

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

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


More information about the core-libs-dev mailing list