diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/JLineReader.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/JLineReader.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala index ab11a53d43..2fe436fd2f 100644 --- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala +++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala @@ -8,13 +8,23 @@ package interpreter import java.io.File import jline.{ ConsoleReader, ArgumentCompletor, History => JHistory } +import scala.tools.util.SignalManager /** Reads from the console using JLine */ class JLineReader(interpreter: Interpreter) extends InteractiveReader { def this() = this(null) - override lazy val history = Some(History(consoleReader)) + override lazy val history = Some(History(consoleReader)) override lazy val completion = Option(interpreter) map (x => new Completion(x)) + override def init() = consoleReader.getTerminal().initializeTerminal() + + /** Requires two interrupt signals within three seconds + * of one another to initiate exit. + */ + SignalManager.requireInterval(3, SignalManager.INT) { + case true => Console.println("\nPress ctrl-C again to exit.") + case false => System.exit(1) + } val consoleReader = { val r = new jline.ConsoleReader() |