Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the "hit [ENTER] to switch to interactive mode" feature #3153

Merged
merged 1 commit into from
Apr 28, 2017

Conversation

dwijnand
Copy link
Member

In sbt 0.13.15, in addition to notifying the user about the existence of
sbt's shell, a feature was added to allow the user to switch to sbt's
shell - a more pro-active approach to just displaying a message.

Unfortunately sbt is often unintentionally invoked in shell scripts in
"interactive mode" when no interaction is expected by, for exmaple,
invoking sbt package instead of sbt package < /dev/null. In that
case hitting [ENTER] would silently trigger sbt to run its shell,
easily wrecking the script. In addition to that I was unhappy with the
implementation as it created a tight coupling between sbt's command
processing abstraction to sbt's shell command.

If you want to stay in sbt's shell after running a task like package
then invoke sbt like so:

sbt package shell

Fixes #3091

Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -182,11 +182,8 @@ object State {
log.debug(s"> $cmd")
f(cmd, s.copy(remainingCommands = remainingCommands, history = cmd :: s.history))
}
def isInteractive = System.console != null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't know why this existed if we have interactive in State.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interactive in State is an indication as to whether sbt is in interactive mode, i.e it's in the process of running shell.

This "interactive" is whether the JVM is running in interactive mode: by virtue of having a stdin and stdout attached.

In sbt 0.13.15, in addition to notifying the user about the existence of
sbt's shell, a feature was added to allow the user to switch to sbt's
shell - a more pro-active approach to just displaying a message.

Unfortunately sbt is often unintentionally invoked in shell scripts in
"interactive mode" when no interaction is expected by, for exmaple,
invoking `sbt package` instead of `sbt package < /dev/null`. In that
case hitting [ENTER] would silently trigger sbt to run its shell,
easily wrecking the script. In addition to that I was unhappy with the
implementation as it created a tight coupling between sbt's command
processing abstraction to sbt's shell command.

If you want to stay in sbt's shell after running a task like `package`
then invoke sbt like so:

    sbt package shell

Fixes sbt#3091
@dwijnand dwijnand force-pushed the kill-enter-to-stay-in-shell branch from 2991e85 to f4cc3d2 Compare April 28, 2017 10:00
@dwijnand dwijnand merged commit 3ea9bbb into sbt:0.13 Apr 28, 2017
@dwijnand dwijnand deleted the kill-enter-to-stay-in-shell branch April 28, 2017 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants