United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4062587 : exec Processes failing with long output.

Details
Type:
Enhancement
Submit Date:
1997-07-01
Status:
Closed
Updated Date:
1998-03-31
Project Name:
JDK
Resolved Date:
1998-03-31
Component:
core-libs
OS:
windows_95
Sub-Component:
java.lang
CPU:
x86
Priority:
P3
Resolution:
Won't Fix
Affected Versions:
1.1.1
Fixed Versions:

Related Reports
Relates:
Relates:

Sub Tasks

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



Name: mc57594			Date: 07/01/97


Try to avoid long output.
======================================================================
                                     
2004-06-11



Hardware and Software, Engineered to Work Together