Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-1229451

Process.waitFor() waits forever after first command is executed

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.0beta2
    • CPU:
      sparc
    • OS:
      generic
    • Verification:
      Not verified

      Description

      class Hang {
          public static void main(String[] args) {
              Runtime r = Runtime.getRuntime();
              String cmd = "/bin/true";
              while (true) {
                  System.out.println("Running " + cmd);
                  try {
                      Process p = r.exec(cmd);
                      int v = p.waitFor();
                      System.out.println(cmd + " returned " + v);
                  } catch (Exception e) {
                      System.err.println("Exception " + e);
                  }
              }
          }
      }

      Consider the above program. When I run it under Solaris with jdk.beta, I get:

      Running /bin/true
      pid 790 status 0
      Received sigchild for 790 exit=0
      /bin/true returned 0
      Running /bin/true

      The second Process.waitFor() never returns, even though the process does exit.

      DREL 11/27/95

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tlindholsunw Timothy Lindholm (Inactive)
              Reporter:
              dlong Dean Long
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: