Skip to content

Commit 404e937

Browse files
committed
ensure exit code is 1 if script fails - also improve error output
1 parent 2bd8543 commit 404e937

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

core/src/main/scala/replpp/scripting/ScriptRunner.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package replpp.scripting
22

3-
import replpp.Config
3+
import replpp.{Config, verboseEnabled}
44
import replpp.util.ClasspathHelper
55

66
import scala.util.{Failure, Success, Try}
@@ -27,19 +27,21 @@ object ScriptRunner {
2727

2828
builder.result()
2929
}
30-
if (replpp.verboseEnabled(config)) println(s"executing `java ${args.mkString(" ")}`")
30+
if (replpp.verboseEnabled(config))
31+
println(s"executing `java ${args.mkString(" ")}`")
32+
3133
Process("java", args).run().exitValue() match {
3234
case 0 => Success(())
33-
case nonZeroExitValue =>
35+
case nonZeroExitValue =>
3436
Failure(new AssertionError(
35-
s"${getClass.getName}: error while invoking `java ${args.mkString(" ")}`: exit code was $nonZeroExitValue"
37+
s"${getClass.getName}: error while invoking $mainClass: exit code was $nonZeroExitValue"
3638
))
3739
}
3840
}
3941

4042
def main(args: Array[String]): Unit = {
4143
val config = Config.parse(args)
42-
exec(config)
44+
exec(config).get
4345
}
4446

4547
}

0 commit comments

Comments
 (0)