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

(process) Runtime.exec: Discrepency between resolutions of 4098442 & 4210128?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95

      Description



      Name: dbT83986 Date: 03/24/99


      In bug 4098442 the team promised to fix the "bug" of process.waitfor()
      not returning if the pipe is full. I have been waiting a very long
      time for this bug fix. Now I read bug report 4210128 where it
      is claimed that this "bug" is actually user error. Why did the story
      change?

       Here is a bit of code that will set off this bug.
      I am still getting the process hanging if there is a lot of output.
      The following snippet runs fine if the output from dir is short.
      It hangs if there is a lot of output.
       Reported against JDK 1.2 on Windows 95.

      String theCommandString="command.com /c dir"
            System.out.println(theCommandString);
            Process p = Runtime.getRuntime().exec(theCommandString, theEnvironment);
            System.out.println("Finished exec");
            InputStream dis = p.getInputStream();
            InputStream err= p.getErrorStream();
            int c;

            String StdError="";
            String StdOut="";
            System.out.println("Begin waitfor");
            p.waitFor();
            System.out.println("End waitfor()");

             while(dis.available()>0 && (c = dis.read()) != -1)
               StdOut+=(char)c;

             while(err.available()>0 && (c = err.read()) != -1)
               StdError+=(char)c;

             int exitVal=p.exitValue();
             //Do clean up
             dis.close();
             err.close();
             p.destroy();
      (Review ID: 55810)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              hongzh Hong Zhang
              Reporter:
              dblairsunw Dave Blair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: