diff options
author | Philipp Haller <hallerp@gmail.com> | 2008-03-11 16:31:28 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2008-03-11 16:31:28 +0000 |
commit | 4b798d9b34187f28bfc41de1deffc87b973ce7c9 (patch) | |
tree | 8f070e7e02271a0aa902f5c06610f3eeceeeda75 /src/partest | |
parent | 5e0d16ad0cd2c58e509336b05b18eb365220ca9a (diff) | |
download | scala-4b798d9b34187f28bfc41de1deffc87b973ce7c9.tar.gz scala-4b798d9b34187f28bfc41de1deffc87b973ce7c9.tar.bz2 scala-4b798d9b34187f28bfc41de1deffc87b973ce7c9.zip |
Fixed #619.
Diffstat (limited to 'src/partest')
-rw-r--r-- | src/partest/scala/tools/partest/nest/Worker.scala | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/partest/scala/tools/partest/nest/Worker.scala b/src/partest/scala/tools/partest/nest/Worker.scala index 86826912a1..fb02190f42 100644 --- a/src/partest/scala/tools/partest/nest/Worker.scala +++ b/src/partest/scala/tools/partest/nest/Worker.scala @@ -334,8 +334,10 @@ class Worker(val fileManager: FileManager) extends Actor { // run compiler in resident mode // $SCALAC -d "$os_dstbase".obj -Xresident -sourcepath . "$@" + try { + val sourcedir = logFile.getParentFile.getCanonicalFile - val sourcepath = sourcedir.getAbsolutePath+"/" + val sourcepath = sourcedir.getAbsolutePath+File.separator NestUI.verbose("sourcepath: "+sourcepath) val argString = @@ -364,6 +366,7 @@ class Worker(val fileManager: FileManager) extends Actor { val resCompile = (line: String) => { NestUI.verbose("compiling "+line) val cmdArgs = List.fromString(line, ' ') map { fs => new File(dir, fs).getAbsolutePath } + NestUI.verbose("cmdArgs: "+cmdArgs) val sett = new Settings(error) sett.sourcepath.value = sourcepath val command = new CompilerCommand(cmdArgs, sett, error, true) @@ -395,7 +398,21 @@ class Worker(val fileManager: FileManager) extends Actor { val tempLogFilePrinter = new PrintWriter(new FileWriter(tempLogFile)) val appender = new StreamAppender(logFileReader, tempLogFilePrinter) - appender.runAndMap({ s => s.replaceAll(dir.getAbsolutePath.replace(File.separatorChar,'/')+File.separator, "") }) + + // function that removes a given string from another string + def removeFrom(line: String, path: String): String = { + // find `path` in `line` + val index = line.indexOf(path) + if (index != -1) { + line.substring(0, index) + line.substring(index + path.length, line.length) + } else line + } + + appender.runAndMap({ s => + val woPath = removeFrom(s, dir.getAbsolutePath/*.replace(File.separatorChar,'/')*/+File.separator) + // now replace single '\' with '/' + woPath.replace('\\', '/') + }) logFileReader.close() tempLogFilePrinter.close() @@ -413,6 +430,12 @@ class Worker(val fileManager: FileManager) extends Actor { succeeded = false } + } catch { + case e: Exception => + e.printStackTrace() + succeeded = false + } + // delete log file only if test was successful if (succeeded) logFile.toDelete = true |