Closed dwighthubbard closed 6 years ago
I took at stab at this but I couldn't find a clean way of doing it. I posted this gist describing the hacky solution running it and pressing Ctrl-C results in a clean exit.
For reference the only solution I found is to:
atexit
registered _python_exit
functionexecutor.shutdown(wait=False)
The reason is that the thread
module registers _python_exit
forcing a
join of the remaining worker threads
This alone is not enough as shutdown
will also join the threads by default so we need to pass wait=False
to the call as well.
I could put together a PR implementing it if it's considered necessary but I'm unsure how temporary this asyncio > thread pool executor solution is.
This implementation will stay until we replace the XMLRPC API on Warehouse is replaced. #5 and #6 are covering that. With a link to the issue on Warehouse/PyPI.
I don't see that being fast. I'll try nudge people again soon.
@cooperlees should I create an MR to cover this KeyboardInterrupt issue? when XMLRPC is replaced we could remove it
@yeraydiazdiaz Sure sir - Less bugs the better! I want to release 3.0 this week so if we could squeeze it in it would be amazing.
Bandersnatch generates an exception message and hangs when keyboard interrupt (ctrl-c) is pressed to force it to exit.
Example output, notice the shell prompt does not appear after hitting ctrl-c because bandersnatch did not exit:
Hitting ctrl-c multiple times will eventually cause bandersnatch to exit.