Support Ctrl-C to interrupt console
Long running tasks in the console cannot be interrupted from within the GUI console view (e.g. a while(1)). However, I can Ctrl-C within the terminal that I launched angr-management from and it will stop the task.
I think the right thing to do here is to respond to Ctrl-C (or whatever binding) as IPython would when launched from a terminal:
In [1]: while True:
...: pass
...:
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
<ipython-input-1-414c137564b4> in <module>
1 while True:
----> 2 pass
3
KeyboardInterrupt:
In [2]:
piggyback on https://github.com/angr/angr-management/pull/277?
We should not have long-running tasks in the main thread. All long-running tasks should be executed as jobs in other threads, then we can kill jobs at any time we want.
This issue has been marked as stale because it has no recent activity. Please comment or add the pinned tag to prevent this issue from being closed.
Because QT does not really allow objects to concurrently exist in multiple threads, our kernel has to run in the same thread as the GUI application if we want it to be able to seamlessly be able to manipulate these objects.
I think the only possible decent resolution to this would be, if this is possible, to have QT listen for the Ctrl-C key binding in a non-main thread, then do os.kill(os.getpid(), signal.SIGINT) as a callback; this would trigger the sigint handler installed by the kernel, which would propagate it to IPython. If QT must listen to keybind events in the main thread, I don't know of an acceptable solution for this issue.
I could not figure out how to do this from a different thread.