-
When you have a utility that wraps gitpython, raising KeyboardInterupt with ctrl-c results in threads that aren't cleanly exited. Is there a process where a KeyboardInterupt can be handled with a clean exit? I tried to see if I could list the threads and try to terminate them, but it seems the ctrl-c triggers the threads to shutdown before it gets to the exception block.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
That's a general issue with all python programs that do IO while being interrupted. |
Beta Was this translation helpful? Give feedback.
That's a general issue with all python programs that do IO while being interrupted.
However, installing a signal handler in the parent application should be able to deal with this gracefully. The idea is to change the program state when receiving a signal so that the application can shut down gracefully. GitPython does not support interruptions though, so long-running clones will have to be waited upon. Common ways to deal with this is to call
os.abort()
orsys.exit
to exit anyway, possibly without any other exceptions particularly in the case ofos.abort()
.