mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
CompilerProcess.java: Use a new thread to handle stdout from the child process.
2005-12-14 Andrew Haley <aph@redhat.com> * gnu/java/rmi/rmic/CompilerProcess.java: Use a new thread to handle stdout from the child process. From-SVN: r108536
This commit is contained in:
committed by
Andrew Haley
parent
3ce4312613
commit
4f9a6d459f
@@ -89,10 +89,27 @@ public abstract class CompilerProcess extends Compiler
|
||||
String[] args = computeArguments (name);
|
||||
Process p = Runtime.getRuntime ().exec (args);
|
||||
|
||||
/* Print compiler output to System.out. */
|
||||
InputStream procin = p.getInputStream();
|
||||
for (int ch = procin.read(); ch != -1; ch = procin.read())
|
||||
System.out.print((char) ch);
|
||||
/* Print compiler output to System.out. Do this asynchronously so
|
||||
that the compiler never blocks writing to its stdout. */
|
||||
{
|
||||
final InputStream procin = p.getInputStream();
|
||||
final Thread copier = new Thread()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int ch = procin.read(); ch != -1; ch = procin.read())
|
||||
System.out.print((char) ch);
|
||||
}
|
||||
catch (java.io.IOException _)
|
||||
{
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
copier.start();
|
||||
}
|
||||
|
||||
/* Collect compiler error output in a buffer.
|
||||
* If compilation fails, it will be used for an error message.
|
||||
|
||||
Reference in New Issue
Block a user