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

2.9.0 REPL exit gives impression release is faulty #4563

Closed
scabug opened this issue May 10, 2011 · 5 comments
Closed

2.9.0 REPL exit gives impression release is faulty #4563

scabug opened this issue May 10, 2011 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 10, 2011

=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===

There are three ways I am aware of for exiting the scala REPL:

  1. Typing "exit"[RETURN] - this appeared to be the standard approach under 2.8
  2. Typing [CTRL]-[D] - under 2.8 this displayed "exit" and executed it as if you had entered the above.
  3. Typing ":quit"[RETURN]

=== What is the expected behavior? ===

All the above options worked fine under 2.8. They displayed what you would expect and exited cleanly.

=== What do you see instead? ===

Under 2.9.0:

  1. Entering "exit"[RETURN] returns the message warning: there were 1 deprecation warnings; re-run with -deprecation for details. This is, as I understand it, because of the change in the definition of exit which I believe now should be replaced with System.exit(0) in code. However, in this context the error message is totally unintuitive and gives the impression that the REPL is faulty.
  2. Entering [CTRL]-[D] exits cleanly but does not display anything and does not issue a newline so the user's terminal prompt is displayed after the scala> prompt. It should either issue a newline or behave in a similar fashion to 2.8 by displaying either System.exit(0) or more neatly :quit.
  3. Entering :quit works fine.

The first case above is the main problem here as it has been the common way of exiting the REPL in the past. Ideally this specific case of the use of "exit" should be handled differently in the REPL and allowed to exit cleanly. If there is a reason why users should be discouraged from using this from now on then it would help a lot if the default deprecation message was replaced with a more transparent message like:

Use of "exit" has been deprecated, please exit the REPL using the command ":quit" or CTRL-D

=== What versions of the following are you using? ===

  • Scala: 2.9.0.RC4 (and latest nightly)
  • Java: 1.6.0_24
  • Operating system: Mac OS 10.6 / 7
@scabug
Copy link
Author

scabug commented May 10, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4563?orig=1
Reporter: Stuart Roebuck (sroebuck)

@scabug
Copy link
Author

scabug commented Jul 23, 2014

@gourlaysama said:
Predef.exit was finally removed in 2.11, so :quit is now the only one way to exit the REPL.

But the Ctrl+D problem still exists (in some shells only, apparently...).

@scabug
Copy link
Author

scabug commented Jul 23, 2014

@som-snytt said (edited on Jul 23, 2014 3:29:21 PM UTC):
Also, the command syntax for sbt and repl is not uniform, so that I'm in the habit of using ctl-D always.

Unfortunately, that's one or two ctl-D's depending on if you ran sbt console or just console at the sbt prompt. Sometimes I lose a terminal window.

The other workaround is to start your repl with an exit function predefined. In fact, I just added it to my init.script.

Oops, actually I already had import sys.exit. It really is nicer to {code}def exit = { Console println "Bye." ; sys.exit } {code}. What a friendly repl.

Now if only repl wouldn't balk when I accidentally :wq instead. Maybe it can do command aliases.

@scabug
Copy link
Author

scabug commented Jul 28, 2014

@gourlaysama said:
I may have a fix for this. Although this won't prevent you from killing sbt / your terminal ;)

@scabug
Copy link
Author

scabug commented Jul 29, 2014

@gourlaysama said:
PR for the remaining part: scala/scala#3902

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants