commit:     ee1f6ff69887dfa02d5c3a3ab3d61163fa504d15
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 16 01:33:29 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Apr 16 01:40:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ee1f6ff6

AsyncioEventLoop: enable SIGINT in exception handler (bug 672540)

Before the exception handler invokes the pdb shell, enable SIGINT so
that the user can exit with Control-C (otherwise SIGKILL is needed).

Bug: https://bugs.gentoo.org/672540
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/util/_eventloop/asyncio_event_loop.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/portage/util/_eventloop/asyncio_event_loop.py 
b/lib/portage/util/_eventloop/asyncio_event_loop.py
index ea0e03b23..a11a10205 100644
--- a/lib/portage/util/_eventloop/asyncio_event_loop.py
+++ b/lib/portage/util/_eventloop/asyncio_event_loop.py
@@ -73,6 +73,11 @@ class AsyncioEventLoop(_AbstractEventLoop):
                        # aid in diagnosis of the problem. If there's no tty, 
then
                        # exit immediately.
                        if all(s.isatty() for s in (sys.stdout, sys.stderr, 
sys.stdin)):
+                               # Restore default SIGINT handler, since 
emerge's Scheduler
+                               # has a SIGINT handler which delays exit until 
after
+                               # cleanup, and cleanup cannot occur here since 
the event
+                               # loop is suspended (see bug 672540).
+                               signal.signal(signal.SIGINT, signal.SIG_DFL)
                                pdb.set_trace()
                        else:
                                # Normally emerge will wait for all coroutines 
to complete

Reply via email to