Skip to content

Commit c5ef2d0

Browse files
authored
Merge pull request #5251 from nrjais/master
Quit REPL when Ctrl+C used instead of throwing exception.
2 parents 3c196b5 + bc10cf7 commit c5ef2d0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.jline.reader._
2626
import scala.annotation.tailrec
2727
import scala.collection.JavaConverters._
2828

29-
3029
/** The state of the REPL contains necessary bindings instead of having to have
3130
* mutation
3231
*
@@ -115,9 +114,9 @@ class ReplDriver(settings: Array[String],
115114
try {
116115
val line = terminal.readLine(completer)
117116
ParseResult(line)
118-
}
119-
catch {
120-
case _: EndOfFileException => // Ctrl+D
117+
} catch {
118+
case _: EndOfFileException |
119+
_: UserInterruptException => // Ctrl+D or Ctrl+C
121120
Quit
122121
}
123122
}

0 commit comments

Comments
 (0)