summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-04-17 12:39:00 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2018-04-17 13:07:01 -0700
commit52c3b417031ec7ebcecd68f7b9f875a5510a9b0b (patch)
treea37b5683a4d8f73010447eee322227f555b2dd59
parent2bc041237984bf674ea144ad1a14710c3ed2e47c (diff)
downloadmill-52c3b417031ec7ebcecd68f7b9f875a5510a9b0b.tar.gz
mill-52c3b417031ec7ebcecd68f7b9f875a5510a9b0b.tar.bz2
mill-52c3b417031ec7ebcecd68f7b9f875a5510a9b0b.zip
avoid printing useless stacktraces when subprocess runs fail
-rw-r--r--scalalib/src/mill/scalalib/JavaModule.scala12
-rw-r--r--scalalib/test/src/mill/scalalib/HelloWorldTests.scala6
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: ")