JDK-4062587 : exec Processes failing with long output.
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.1.1
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_95
  • CPU: x86
  • Submitted: 1997-07-01
  • Updated: 1998-03-31
  • Resolved: 1998-03-31
Related Reports
Relates :  
Relates :  
Description

Name: mc57594			Date: 07/01/97


Spawning a process with the exec method will fail if the
output from the process is sufficiently long. I have used 
exec() to initiate javac, so i don't know if the problem lies
in the Process class or javac.

The process in the following code will hang if the output from
javac, due to errors or warnings, is sufficiently long - about
20 lines or so:

(note: try blocks will have to inserted for this to compile)

String s = "j:\\java\\bin\\javac test.java";
Process comp = Runtime.getRuntime().exec( sb );
input = comp.getInputStream();
error = comp.getErrorStream();
comp.waitFor();

/**
 * Code will not get past here.
 */

byte[] imess = new byte[input.available()];
byte[] emess = new byte[error.available()];
input.read(imess);
error.read(emess);

if (imess.length > 0) System.out.println(new String(imess));
if (emess.length > 0) System.out.println(new String(emess));

return comp.exitValue()==0;


======================================================================

Comments
WORK AROUND Name: mc57594 Date: 07/01/97 Try to avoid long output. ======================================================================
2004-06-11

EVALUATION Converting to RFE. The current Runtime.exec() behavior requires that you read the stderr and stdout of the exec-ed process. We need an API where the user can specify that they are not interested in the stdout and stderr of the execed process. anand.palaniswamy@Eng 1997-08-12 We aren't going to add an API to specify this kind of behaviour. We've updated the documentation for java.lang.Process to note that you are required to read the output from the subprocess or the process might block. THough it is regrettable, this is acceptable behaviour. tom.rodriguez@Eng 1998-03-31
1998-03-31