Re-add SIGINT handler in inspect_response after shell closes

This commit is contained in:
Harrison Gregg 2017-09-09 13:54:48 +06:30
parent b8fabeed86
commit 8d97f49e5e
1 changed files with 4 additions and 0 deletions

View File

@ -164,7 +164,11 @@ class Shell(object):
def inspect_response(response, spider):
"""Open a shell to inspect the given response"""
# Shell.start removes the SIGINT handler, so save it and re-add it after
# the shell has closed
sigint_handler = signal.getsignal(signal.SIGINT)
Shell(spider.crawler).start(response=response, spider=spider)
signal.signal(signal.SIGINT, sigint_handler)
def _request_deferred(request):