This is the mail archive of the java-prs@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgcj/30937] Win32: Process.exitValue() does not work after multiple calls to a terminated process



------- Comment #1 from r_ovidius at eml dot cc  2007-02-23 20:53 -------
Also seems to affect process.destroy() somehow.  The "DONE" is not printed
after the destroy call on gcj win32, but is on Sun.




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);
      }

      process.destroy();

      System.err.println("DONE");

    } catch (Exception e) {
      e.printStackTrace();
    }

  }

}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30937


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]