From c41d428dbcafe5e1a28c2ce6291998d334c1b857 Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 13 Mar 2017 15:44:28 +0000 Subject: [PATCH] Handle non-shell sbt startup warning The sbt/sbt-launcher-package doesn't invoke sbt with the "shell" command. sbt has a mechanism for handling this in its "boot" command that adds an "iflast shell" to the commands. Handle this when displaying the "Executing in batch mode" warning. Fixes #3004 --- main/src/main/scala/sbt/MainLoop.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/src/main/scala/sbt/MainLoop.scala b/main/src/main/scala/sbt/MainLoop.scala index 80d18c986..a9b9edcf3 100644 --- a/main/src/main/scala/sbt/MainLoop.scala +++ b/main/src/main/scala/sbt/MainLoop.scala @@ -74,7 +74,12 @@ object MainLoop { val loggedState = state.copy(globalLogging = newLogging) def isInteractive = System.console() != null def hasShell = state.remainingCommands contains "shell" - if (isInteractive && !hasShell) { + /** + * The "boot" command adds "iflast shell" ("if last shell") + * which basically means it falls back to shell if there are no further commands + */ + def endsWithBoot = state.remainingCommands.lastOption exists (_ == "boot") + if (isInteractive && !hasShell && !endsWithBoot) { state.log warn "Executing in batch mode." state.log warn " For better performance, hit [ENTER] to switch to interactive mode, or" state.log warn " consider launching sbt without any commands, or explicitly passing 'shell'"