diff options
-rw-r--r-- | core/src/main/scala/mill/Main.scala | 5 | ||||
-rw-r--r-- | core/src/main/scala/mill/main/MainRunner.scala | 14 | ||||
-rw-r--r-- | integration/src/test/scala/mill/integration/IntegrationTestSuite.scala | 9 |
3 files changed, 21 insertions, 7 deletions
diff --git a/core/src/main/scala/mill/Main.scala b/core/src/main/scala/mill/Main.scala index 9d0c328f..c2439f29 100644 --- a/core/src/main/scala/mill/Main.scala +++ b/core/src/main/scala/mill/Main.scala @@ -52,7 +52,10 @@ object Main { welcomeBanner = None ) - val runner = new mill.main.MainRunner(config, show) + val runner = new mill.main.MainRunner( + config, show, + System.out, System.err, System.in, System.out, System.err + ) if (repl){ runner.printInfo("Loading...") runner.runRepl() diff --git a/core/src/main/scala/mill/main/MainRunner.scala b/core/src/main/scala/mill/main/MainRunner.scala index 869975bc..93016453 100644 --- a/core/src/main/scala/mill/main/MainRunner.scala +++ b/core/src/main/scala/mill/main/MainRunner.scala @@ -1,4 +1,6 @@ package mill.main +import java.io.{InputStream, OutputStream, PrintStream} + import ammonite.interp.{Interpreter, Preprocessor} import ammonite.ops.Path import ammonite.util.{Imports, Name, Res, Util} @@ -11,11 +13,13 @@ import upickle.Js * `build.sc` scripts with mill-specific tweaks such as a custom * `scriptCodeWrapper` or with a persistent evaluator between runs. */ -class MainRunner(config: ammonite.main.Cli.Config, show: Boolean) - extends ammonite.MainRunner( - config, - System.out, System.err, System.in, System.out, System.err - ){ +class MainRunner(config: ammonite.main.Cli.Config, show: Boolean, + outprintStream: PrintStream, + errPrintStream: PrintStream, + stdIn: InputStream, + stdOut: OutputStream, + stdErr: OutputStream) + extends ammonite.MainRunner(config, outprintStream, errPrintStream, stdIn, stdOut, stdErr){ var lastEvaluator: Option[(Seq[(Path, Long)], Evaluator[_])] = None override def runScript(scriptPath: Path, scriptArgs: List[String]) = watchLoop( diff --git a/integration/src/test/scala/mill/integration/IntegrationTestSuite.scala b/integration/src/test/scala/mill/integration/IntegrationTestSuite.scala index e79eebe0..01e73ad5 100644 --- a/integration/src/test/scala/mill/integration/IntegrationTestSuite.scala +++ b/integration/src/test/scala/mill/integration/IntegrationTestSuite.scala @@ -1,12 +1,19 @@ package mill.integration +import java.io.{ByteArrayInputStream, ByteArrayOutputStream, InputStream, PrintStream} + import ammonite.ops._ import utest._ abstract class IntegrationTestSuite(repoKey: String, workspaceSlug: String) extends TestSuite{ val workspacePath = pwd / 'target / 'workspace / workspaceSlug val buildFilePath = pwd / 'integration / 'src / 'test / 'resource / workspaceSlug - val runner = new mill.main.MainRunner(ammonite.main.Cli.Config(wd = workspacePath), false) + val stdOutErr = new PrintStream(new ByteArrayOutputStream()) + val stdIn = new ByteArrayInputStream(Array()) + val runner = new mill.main.MainRunner( + ammonite.main.Cli.Config(wd = workspacePath), false, + stdOutErr, stdOutErr, stdIn, stdOutErr, stdOutErr + ) def eval(s: String*) = runner.runScript(workspacePath / "build.sc", s.toList) def initWorkspace() = { rm(workspacePath) |