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 [EMAIL PROTECTED]
EV: 5 [EMAIL PROTECTED]

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

Reply via email to