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
This commit is contained in:
Dale Wijnand 2017-03-13 15:44:28 +00:00 committed by Eugene Yokota
parent 6d3129dcb7
commit c41d428dbc
1 changed files with 6 additions and 1 deletions

View File

@ -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'"