Open jacksonloper opened 9 years ago
Yes, currently the kernel can't be interrupted (the kernel is restarted instead).
At the moment, I don't know how to implement a kernel interruption. I could send a SIGINT signal, but the SIGINT handler won't be run until the running function is stopped.
Instead and ideally, what I would like is for IJavascript to be able to save and restore sessions (like the R shell does). Unfortunately Node.js only provides .save
and .load
to save and load the list of executed commands:
> .help
.break Sometimes you get stuck, this gets you out
.clear Alias for .break
.exit Exit the repl
.help Show repl options
.load Load JS from a file into the REPL session
.save Save all evaluated commands in this REPL session to a file
PS: I've created issue #52 to track the bug of kernel restart requests not publishing the kernel status.
An option (that depends on node-gyp): https://github.com/tjanczuk/tripwire https://github.com/nodejs/node/issues/1268
Eek! I see this is much trickier than I had hoped. We need to find somebody willing to reopen nodejs/node#1268 and get it solved :). I fear it might involve very tricky changes to node core itself... ok... not happening soon.
If tripwire could work, that would be a great stopgap. Set the default timeout to 2 seconds, put $$tripwire$$ in the global namespace so that users can set the timeout to something else if they need to run a long piece of code. But I'm not sure if tripwire will actually allow you to recover from a tripwire exception. I raised a new issue around this question at tjanczuk/tripwire#8. It may well be that I'm not understanding something very fundamental though... :)
Interrupting the kernel appears to actually be equivalent to restarting the kernel. That is,
Also, the kernel doesn't appear to succesfully inform jupyter that the kernel is busy (by making the little circle in the upper-right into a filled circle).