You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trap Ctrl-C in the REPL: if no command is running clear the prompt, if some command is running ask for confirmation before exiting (#24127)
This ports over one of the other Ammonite features to the Scala 3 REPL,
making it behave much more similarly to other prompt environment (Bash,
Python, etc.):
- If there is no code running, `Ctrl-C` just resets the prompt without
exiting
- If there is code running, `Ctrl-C` first interrupts the thread to try
and force a gentle exit. A second `Ctrl-C` would then terminate the
process.
Unfortunately we will no longer be able to terminate the thread
forcefully, as `Thread.stop` is busted Java >20 (see
com-lihaoyi/Ammonite#1379), so using
`Thread.interrupt` and `sys.exit` is the best we have
Tested manually using `bin/scala`. Doesn't work in `sbt repl` due to SBT
also intercepting the signal, but that's a separate issue we can follow
up later
0 commit comments