From 11d63577f44af4caa2ecc5553ac23359e83b18a3 Mon Sep 17 00:00:00 2001 From: aph Date: Wed, 14 Dec 2005 20:26:30 +0000 Subject: [PATCH] 2005-12-14 Andrew Haley * gnu/java/rmi/rmic/CompilerProcess.java: Use a new thread to handle stdout from the child process. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108536 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 5 +++++ libjava/gnu/java/rmi/rmic/CompilerProcess.java | 25 +++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index bee1eb0..be55e41 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2005-12-14 Andrew Haley + + * gnu/java/rmi/rmic/CompilerProcess.java: Use a new thread to + handle stdout from the child process. + 2005-12-14 Tom Tromey PR classpath/25389: diff --git a/libjava/gnu/java/rmi/rmic/CompilerProcess.java b/libjava/gnu/java/rmi/rmic/CompilerProcess.java index 3cf801d..09f8d9c 100644 --- a/libjava/gnu/java/rmi/rmic/CompilerProcess.java +++ b/libjava/gnu/java/rmi/rmic/CompilerProcess.java @@ -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. -- 2.7.4