Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

Commit 09d2dcc

Browse files
committed
Remove no-op stream capture around javac call
We fork a process with a process logger that redirects stdout and stderr to a log file, so I can't see why this was ever needed. Tested: ``` Note: test execution will be non-parallel under -Dpartest.exec.in.process % scalac t1459/InheritingPrinter.scala t1459/JavaPrinter.java t1459/ScalaPrinter.scala t1459/Test.java t1459/VarArg.java !! 1 - run/t1459 [compilation failed] % scalac t1459/InheritingPrinter.scala t1459/JavaPrinter.java t1459/ScalaPrinter.scala t1459/Test.java t1459/VarArg.java JavaPrinter.java:1: error: illegal start of type declaration public cla ss JavaPrinter implements VarArg { ^ one error found partest --update-check \ /Users/jz/code/scala/test/files/run/t1459 ```
1 parent 0e63ce5 commit 09d2dcc

File tree

2 files changed

+1
-36
lines changed

2 files changed

+1
-36
lines changed

src/main/scala/scala/tools/partest/nest/Runner.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ class Runner(val testFile: File, val suiteRunner: SuiteRunner, val nestUI: NestU
131131
)
132132

133133
pushTranscript(args mkString " ")
134-
val captured = StreamCapture(runCommand(args, logFile))
135-
if (captured.result) genPass() else {
136-
logFile appendAll captured.stderr
134+
if (runCommand(args, logFile)) genPass() else {
137135
genFail("java compilation failed")
138136
}
139137
}

src/main/scala/scala/tools/partest/nest/StreamCapture.scala

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,6 @@ import java.io.{Console => _, _}
99
import java.nio.charset.Charset
1010

1111
object StreamCapture {
12-
case class Captured[T](stdout: String, stderr: String, result: T) {
13-
override def toString = s"""
14-
|result: $result
15-
|[stdout]
16-
|$stdout
17-
|[stderr]
18-
|$stderr""".stripMargin.trim
19-
}
20-
21-
private def mkStream = {
22-
val swr = new StringWriter
23-
val wr = new PrintWriter(swr, true)
24-
val ostream = new PrintStream(new OutputStream { def write(b: Int): Unit = wr write b }, true) // autoFlush = true
25-
26-
(ostream, () => { ostream.close() ; swr.toString })
27-
}
28-
2912
def savingSystem[T](body: => T): T = {
3013
val savedOut = System.out
3114
val savedErr = System.err
@@ -36,22 +19,6 @@ object StreamCapture {
3619
}
3720
}
3821

39-
def apply[T](body: => T): Captured[T] = {
40-
val (outstream, stdoutFn) = mkStream
41-
val (errstream, stderrFn) = mkStream
42-
43-
val result = savingSystem {
44-
System setOut outstream
45-
System setErr errstream
46-
Console.withOut(outstream) {
47-
Console.withErr(errstream) {
48-
body
49-
}
50-
}
51-
}
52-
Captured(stdoutFn(), stderrFn(), result)
53-
}
54-
5522
def capturingOutErr[A](output: OutputStream)(f: => A): A = {
5623
import java.io._
5724
val charset = Charset.defaultCharset()

0 commit comments

Comments
 (0)