Skip to content

Conversation

@timharley
Copy link

In the REPL it is possible to interrupt the computation of an expression using ctrl+c and return to the repl, rather than exiting the interpreter. e.g. If an object big_object is really expensive to print, we can interrupt print(big_object) and return to the repl.

However, interrupting the semantically similar =big_object exits the interpreter.

This patch catches signals that occur whilst doing the latter, making the behaviour more consistent.

An alternative and more involved approach would be to change =big_object to execute print(big_object) rather than return big_object.

@timharley
Copy link
Author

What are your thoughts @andresy, @koraykv?

@andresy
Copy link
Owner

andresy commented Oct 15, 2014

Hi Tim, not sure, I would have to dig into it, but my week is overbooked. I know catching signals can lead to unwanted behaviors -- did you check luajit's mailing list in that respect? I remember there are several comments about this. Is this fix for TREPL, btw, or the REPL in general? Maybe @clementfarabet can also comment on this.

@timharley
Copy link
Author

This is behaviour of the luajit repl, rather than the torch repl (if you mean this). I copied the signal handling from src/luajit.c:119-125, where the repl catches signals whilst executing a line.

I did a cursory scan of the luajit mailing list and didn't see any showstoppers for this patch. Would that be a better place to submit it?

This is not a priority, so no rush!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants