File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
compiler/src/dotty/tools/repl Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ class ReplDriver(settings: Array[String],
212212 // Set up interrupt handler for command execution
213213 var firstCtrlCEntered = false
214214 val thread = Thread .currentThread()
215- val signalHandler = terminal.handle(
215+ val previousSignalHandler = terminal.handle(
216216 org.jline.terminal.Terminal .Signal .INT ,
217217 (sig : org.jline.terminal.Terminal .Signal ) => {
218218 val now = System .currentTimeMillis()
@@ -222,15 +222,16 @@ class ReplDriver(settings: Array[String],
222222 out.println(" \n Interrupting running thread, Ctrl-C again to terminate the process" )
223223 }else {
224224 out.println(" \n Terminating REPL..." )
225-
226225 System .exit(130 ) // Standard exit code for SIGINT
227226 }
228227 }
229228 )
230229
231- val newState = interpret(res)
232- // Restore previous handler
233- terminal.handle(org.jline.terminal.Terminal .Signal .INT , signalHandler)
230+ val newState =
231+ try interpret(res)
232+ // Restore previous handler
233+ finally terminal.handle(org.jline.terminal.Terminal .Signal .INT , previousSignalHandler)
234+
234235 loop(using newState)()
235236 }
236237 }
You can’t perform that action at this time.
0 commit comments