diff options
author | Philipp Haller <hallerp@gmail.com> | 2008-10-15 21:26:38 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2008-10-15 21:26:38 +0000 |
commit | 8a3bbb52a720df0864526f5817030aa1879a786a (patch) | |
tree | ccc2be550de83a59645b15ccae33dfa318d69824 /src | |
parent | acd4c9471dcccc1ba1e97d4e6f4f86323e52355f (diff) | |
download | scala-8a3bbb52a720df0864526f5817030aa1879a786a.tar.gz scala-8a3bbb52a720df0864526f5817030aa1879a786a.tar.bz2 scala-8a3bbb52a720df0864526f5817030aa1879a786a.zip |
Improved error reporting when running external ...
Improved error reporting when running external programs such as javac.
Diffstat (limited to 'src')
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 2e856b956e..c6462cacae 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -174,13 +174,16 @@ class Worker(val fileManager: FileManager) extends Actor { " -classpath "+outDir+File.pathSeparator+CLASSPATH+ " "+files.mkString(" ") - runCommand(cmd, output) + val exitCode = runCommand(cmd, output) + if (exitCode != 0) { + NestUI.failure("Running \"javac\" failed with exit code: "+exitCode+"\n") + } } /** Runs <code>command</code> redirecting standard out and * error out to <code>output</code> file. */ - def runCommand(command: String, output: File) { + def runCommand(command: String, output: File): Int = { NestUI.verbose("running command:\n"+command) val proc = Runtime.getRuntime.exec(command) val in = proc.getInputStream @@ -195,6 +198,11 @@ class Worker(val fileManager: FileManager) extends Actor { inApp.run() async.join() writer.close() + try { + proc.exitValue() + } catch { + case e: IllegalThreadStateException => 1 + } } def execTest(outDir: File, logFile: File, fileBase: String) { @@ -322,7 +330,9 @@ class Worker(val fileManager: FileManager) extends Actor { script(logFile, outDir) } catch { case e: Exception => - e.printStackTrace + val writer = new PrintWriter(new FileWriter(logFile), true) + e.printStackTrace(writer) + writer.close() succeeded = false } |