From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15962 invoked by alias); 23 Feb 2007 19:37:29 -0000 Received: (qmail 15792 invoked by uid 48); 23 Feb 2007 19:37:17 -0000 Date: Fri, 23 Feb 2007 19:37:00 -0000 Subject: [Bug libgcj/30937] New: Win32: Process.exitValue() does not work after multiple calls to a terminated process X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "r_ovidius at eml dot cc" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-02/txt/msg02715.txt.bz2 After calling process.waitFor(), or calling process.exitValue() multiple times on a process that has exited, the process returns "java.lang.IllegalThreadStateException: Process has not exited" even though it has. Sun's java, and gcj on linux does not have this problem. Result on SUN win32: 5 EV: 5 java.lang.ProcessImpl@13e8d89 EV: 5 java.lang.ProcessImpl@13e8d89 Result on GCJ 4.2 Win: (probably 4.3 as well since it doesn't look changed in viewcvs): 5 X: java.lang.IllegalThreadStateException: Process has not exited X: java.lang.IllegalThreadStateException: Process has not exited Snippet: import java.io.FileOutputStream; import java.io.PrintStream; public class ProcTest { static Process process; public static void main(String[] args) { try { String bat = "exitcode.bat"; PrintStream p = new PrintStream(new FileOutputStream(bat)); p.println("@exit 5"); p.close(); process = Runtime.getRuntime().exec(bat); try { int wf = process.waitFor(); System.err.println(wf); } catch (InterruptedException e) { } try { int ev = process.exitValue(); System.err.println("EV: " + ev + " " + process); } catch (IllegalThreadStateException ile) { System.err.println("X: " + ile); } try { int ev = process.exitValue(); System.err.println("EV: " + ev + " " + process); } catch (IllegalThreadStateException ile) { System.err.println("X: " + ile); } } catch (Exception e) { e.printStackTrace(); } } } -- Summary: Win32: Process.exitValue() does not work after multiple calls to a terminated process Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcj AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: r_ovidius at eml dot cc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30937