From 8d97f49e5e31955fb972dc63106298032ebe0e59 Mon Sep 17 00:00:00 2001 From: Harrison Gregg Date: Sat, 9 Sep 2017 13:54:48 +0630 Subject: [PATCH] Re-add SIGINT handler in inspect_response after shell closes --- scrapy/shell.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scrapy/shell.py b/scrapy/shell.py index 80b625633..af91d6ce0 100644 --- a/scrapy/shell.py +++ b/scrapy/shell.py @@ -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):