aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-02-25 10:26:33 -0600
committerJesse Luehrs <doy@tozt.net>2013-02-25 10:26:33 -0600
commitb688e10a0276ff24384f5a5327f5c142a51cff89 (patch)
tree3076be985a87f89d96dc846c1dd9e6761aacab47
parent28f780b1b141cb9abc2e7aa9762f675cea76bcc1 (diff)
downloadscala-test-more-b688e10a0276ff24384f5a5327f5c142a51cff89.tar.gz
scala-test-more-b688e10a0276ff24384f5a5327f5c142a51cff89.zip
comment that, because it's a bit non-obvious
-rw-r--r--src/main/scala/org/perl8/test/ExternalTest.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/scala/org/perl8/test/ExternalTest.scala b/src/main/scala/org/perl8/test/ExternalTest.scala
index 5c3be81..533570c 100644
--- a/src/main/scala/org/perl8/test/ExternalTest.scala
+++ b/src/main/scala/org/perl8/test/ExternalTest.scala
@@ -10,12 +10,21 @@ import scala.annotation.tailrec
class ExternalTest (cmdLine: Seq[String]) extends Test {
def run: Int = {
val processBuilder = new ProcessBuilder(cmdLine: _*)
+
+ // Ensure that if stdout and stderr are both pointing to the same place (a
+ // terminal or file or something) that they remain synchronized. This is
+ // only possible if the endpoint they are streaming to is the same place
+ // underneath, with no extra processing in between. (This is safe because
+ // stdout is typically line-buffered, and we only ever output a line at a
+ // time when writing TAP, so in theory, buffering of the underlying file
+ // descriptor shouldn't make a difference here)
if (Console.out eq System.out) {
processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT)
}
if (Console.err eq System.err) {
processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT)
}
+
val process = processBuilder.start
val streams = Seq(