How to interrupt (not kill) julia from the REPL?

benninkrs
Sun, 31 Mar 2019 15:45:44 +0000
General Usage

From the REPL, how do I interrupt execution of a function? Basically, I want to press some command key and cause it to throw an error that I can catch. For example:

function interruptable_loop()
  try
    while not_done
      # some computation
    end
  catch
     println("function terminated by user")
     # cleanup
  end
end

From reading some old threads, I got the impression that (on Windows) pressing ctrl+c would do what I want. I find that it does nothing unless I press it four times rapidly, in which case it kills the whole Julia session, not merely throw an error. Same thing in Juno.
(This is on Julia 1.0.0).

26 posts - 9 participants