Skip to content

Commit

Permalink
run pre/post handler hooks around eventloop dispatch
Browse files Browse the repository at this point in the history
ensures signal handlers are properly restored after exiting eventloop
  • Loading branch information
minrk committed Jan 16, 2018
1 parent 1bb6a1f commit f5d5ffc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ipykernel/kernelbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def enter_eventloop(self):
# which may be skipped by entering the eventloop
stream.flush(zmq.POLLOUT)
# restore default_int_handler
signal(SIGINT, default_int_handler)
self.pre_handler_hook()
while self.eventloop is not None:
try:
self.eventloop(self)
Expand All @@ -269,6 +269,7 @@ def enter_eventloop(self):
# eventloop exited cleanly, this means we should stop (right?)
self.eventloop = None
break
self.post_handler_hook()
self.log.info("exiting eventloop")

def start(self):
Expand Down

0 comments on commit f5d5ffc

Please sign in to comment.