Skip to content

Catch interrupted poll() in terminal console#8129

Merged
minrk merged 1 commit intoipython:masterfrom
takluyver:i8105-b
Mar 24, 2015
Merged

Catch interrupted poll() in terminal console#8129
minrk merged 1 commit intoipython:masterfrom
takluyver:i8105-b

Conversation

@takluyver
Copy link
Copy Markdown
Member

Alternative to my own PR #8108 - catch ZMQError in run_cell, and if it's caused by an interrupt, ignore it.
#8108 catches the exception in the blocking kernel client API, which is more complex, especially if we want to handle the timeout nicely as proposed in the comments, but it's possibly also more convenient for other users of that API. Or perhaps not - I'm not sure what makes sense for other API consumers in this case.

Fixes gh-8105

Alternative to my own PR ipython#8108 - catch ZMQError in run_cell, and if it's
caused by an interrupt, ignore it.

more complex, especially if we want to handle the timeout nicely as
proposed in the comments, but it's possibly also more convenient for
other users of that API. Or perhaps not - I'm not sure what makes sense
for other API consumers in this case.

Fixes ipythongh-8105
@takluyver takluyver added this to the 3.1 milestone Mar 24, 2015
@minrk
Copy link
Copy Markdown
Member

minrk commented Mar 24, 2015

I think this will misbehave if you do:

try:
    time.sleep(10)
except KeyboardInterrupt:
    print("interrupted")
foo = input('foo> ')

and interrupt the sleep.

@minrk
Copy link
Copy Markdown
Member

minrk commented Mar 24, 2015

Nope, totally wrong. I missed the while True. Ignore that.

@minrk
Copy link
Copy Markdown
Member

minrk commented Mar 24, 2015

I think this should work. It's definitely nice to not need the deadline handling.

minrk added a commit that referenced this pull request Mar 24, 2015
Catch interrupted poll() in terminal console
@minrk minrk merged commit 9cebc2d into ipython:master Mar 24, 2015
minrk added a commit that referenced this pull request Mar 25, 2015
Alternative to my own PR #8108 - catch ZMQError in run_cell, and if it's caused by an interrupt, ignore it.

#8108 catches the exception in the blocking kernel client API, which is more complex, especially if we want to handle the timeout nicely as proposed in the comments, but it's possibly also more convenient for other users of that API. Or perhaps not - I'm not sure what makes sense for other API consumers in this case.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console crashes when interrupted during execution

2 participants