public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/30937]  New: Win32: Process.exitValue() does not work after multiple calls to a terminated process
@ 2007-02-23 19:37 r_ovidius at eml dot cc
  2007-02-23 20:53 ` [Bug libgcj/30937] " r_ovidius at eml dot cc
  0 siblings, 1 reply; 2+ messages in thread
From: r_ovidius at eml dot cc @ 2007-02-23 19:37 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libgcj/30937] Win32: Process.exitValue() does not work after multiple calls to a terminated process
  2007-02-23 19:37 [Bug libgcj/30937] New: Win32: Process.exitValue() does not work after multiple calls to a terminated process r_ovidius at eml dot cc
@ 2007-02-23 20:53 ` r_ovidius at eml dot cc
  0 siblings, 0 replies; 2+ messages in thread
From: r_ovidius at eml dot cc @ 2007-02-23 20:53 UTC (permalink / raw)
  To: java-prs



------- 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-23 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-23 19:37 [Bug libgcj/30937] New: Win32: Process.exitValue() does not work after multiple calls to a terminated process r_ovidius at eml dot cc
2007-02-23 20:53 ` [Bug libgcj/30937] " r_ovidius at eml dot cc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).