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