Update of /cvsroot/nice/Nice/src/nice/tools/compiler
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31650/src/nice/tools/compiler
Modified Files:
native.nice
Log Message:
Fixed native compilation using gcj. It used to block when gcj produced
too much output.
Index: native.nice
===================================================================
RCS file: /cvsroot/nice/Nice/src/nice/tools/compiler/native.nice,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** native.nice 23 Jan 2004 13:00:23 -0000 1.6
--- native.nice 18 Jun 2004 13:16:30 -0000 1.7
***************
*** 43,53 ****
"--main=" + pkg + ".fun",
"-o", output, jar ]);
! p.waitFor();
! if (p.exitValue() != 0)
{
fail();
! // Print the content of stderr.
! let in = new BufferedReader(new InputStreamReader(p.getErrorStream()));
try {
for (?String line = in.readLine(); line != null;
--- 43,54 ----
"--main=" + pkg + ".fun",
"-o", output, jar ]);
! let CharArrayWriter output = new CharArrayWriter();
! let exitValue = waitFor(p, output);
! if (exitValue != 0)
{
fail();
! // Print the output of the process
! let in = new BufferedReader(new CharArrayReader(output.toCharArray));
try {
for (?String line = in.readLine(); line != null;
***************
*** 74,75 ****
--- 75,104 ----
java.lang.System.out.println();
}
+
+ int waitFor(Process p, Writer w)
+ {
+ let out = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ let err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+
+ let printer = new PrintWriter(w);
+
+ while (true)
+ {
+ if (out.ready)
+ for (?String line = out.readLine(); line != null;
+ line = out.readLine())
+ printer.println(line);
+
+ if (err.ready)
+ for (?String line = err.readLine(); line != null;
+ line = err.readLine())
+ printer.println(line);
+
+ try {
+ return p.exitValue();
+ }
+ catch(IllegalThreadStateException e) {
+ // The process is not finished yet.
+ }
+ }
+ }
|