diff options
-rw-r--r-- | scalalib/src/mill/scalalib/JavaModule.scala | 12 | ||||
-rw-r--r-- | scalalib/test/src/mill/scalalib/HelloWorldTests.scala | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/scalalib/src/mill/scalalib/JavaModule.scala b/scalalib/src/mill/scalalib/JavaModule.scala index 3134851e..0a396a53 100644 --- a/scalalib/src/mill/scalalib/JavaModule.scala +++ b/scalalib/src/mill/scalalib/JavaModule.scala @@ -250,14 +250,16 @@ trait JavaModule extends mill.Module with TaskModule { outer => } def run(args: String*) = T.command{ - Jvm.interactiveSubprocess( + try Result.Success(Jvm.interactiveSubprocess( finalMainClass(), runClasspath().map(_.path), forkArgs(), forkEnv(), args, workingDir = ammonite.ops.pwd - ) + )) catch { case e: InteractiveShelloutException => + Result.Failure("subprocess failed") + } } @@ -270,14 +272,16 @@ trait JavaModule extends mill.Module with TaskModule { outer => } def runMain(mainClass: String, args: String*) = T.command{ - Jvm.interactiveSubprocess( + try Result.Success(Jvm.interactiveSubprocess( mainClass, runClasspath().map(_.path), forkArgs(), forkEnv(), args, workingDir = ammonite.ops.pwd - ) + )) catch { case e: InteractiveShelloutException => + Result.Failure("subprocess failed") + } } // publish artifact with name "mill_2.12.4" instead of "mill_2.12" diff --git a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala index a52ab7a1..f1342d04 100644 --- a/scalalib/test/src/mill/scalalib/HelloWorldTests.scala +++ b/scalalib/test/src/mill/scalalib/HelloWorldTests.scala @@ -311,11 +311,7 @@ object HelloWorldTests extends TestSuite { 'notRunInvalidMainObject - workspaceTest(HelloWorld){eval => - val Left(Result.Exception(err, _)) = eval.apply(HelloWorld.core.runMain("Invalid")) - - assert( - err.isInstanceOf[InteractiveShelloutException] - ) + val Left(Result.Failure("subprocess failed", _)) = eval.apply(HelloWorld.core.runMain("Invalid")) } 'notRunWhenCompileFailed - workspaceTest(HelloWorld){eval => write.append(HelloWorld.millSourcePath / 'core / 'src / "Main.scala", "val x: ") |