diff --git a/runner/src/mill/runner/MillMain.scala b/runner/src/mill/runner/MillMain.scala index ee369ecb384..eb785dbe35f 100644 --- a/runner/src/mill/runner/MillMain.scala +++ b/runner/src/mill/runner/MillMain.scala @@ -50,16 +50,20 @@ object MillMain { val (result, _) = try main0( - args, - RunnerState.empty, - mill.util.Util.isInteractive(), - runnerStreams, - bspLog, - System.getenv().asScala.toMap, - b => (), - Map(), - sys.props.toMap - ) finally { + args = args, + stateCache = RunnerState.empty, + mainInteractive = mill.util.Util.isInteractive(), + streams0 = runnerStreams, + bspLog = bspLog, + env = System.getenv().asScala.toMap, + setIdle = b => (), + userSpecifiedProperties0 = Map(), + initialSystemProperties = sys.props.toMap + ) + finally { + System.setOut(initialSystemStreams.out) + System.setErr(initialSystemStreams.err) + System.setIn(initialSystemStreams.in) openStreams.foreach(_.close()) } System.exit(if (result) 0 else 1) diff --git a/runner/src/mill/runner/MillServerMain.scala b/runner/src/mill/runner/MillServerMain.scala index 8b52d0b4b51..383848d341c 100644 --- a/runner/src/mill/runner/MillServerMain.scala +++ b/runner/src/mill/runner/MillServerMain.scala @@ -69,7 +69,7 @@ object MillServerMain extends MillServerMain[RunnerState] { args = args, stateCache = stateCache, mainInteractive = mainInteractive, - streams = streams, + streams0 = streams, bspLog = None, env = env, setIdle = setIdle,