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 @@ -228,7 +228,7 @@ class ReplDriver(settings: Array[String],
228228 // Set up interrupt handler for command execution
229229 var firstCtrlCEntered = false
230230 val thread = Thread .currentThread()
231- val signalHandler = terminal.handle(
231+ val previousSignalHandler = terminal.handle(
232232 org.jline.terminal.Terminal .Signal .INT ,
233233 (sig : org.jline.terminal.Terminal .Signal ) => {
234234 val now = System .currentTimeMillis()
@@ -238,15 +238,16 @@ class ReplDriver(settings: Array[String],
238238 out.println(" \n Interrupting running thread, Ctrl-C again to terminate the process" )
239239 }else {
240240 out.println(" \n Terminating REPL..." )
241-
242241 System .exit(130 ) // Standard exit code for SIGINT
243242 }
244243 }
245244 )
246245
247- val newState = interpret(res)
248- // Restore previous handler
249- terminal.handle(org.jline.terminal.Terminal .Signal .INT , signalHandler)
246+ val newState =
247+ try interpret(res)
248+ // Restore previous handler
249+ finally terminal.handle(org.jline.terminal.Terminal .Signal .INT , previousSignalHandler)
250+
250251 loop(using newState)()
251252 }
252253 }
You can’t perform that action at this time.
0 commit comments