cmd.py: AutoInterrupt.__del__: Avoid some unwanted tracebacks by catching some more errors #576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I see the following in an application that uses GitPython:
When the application raises an unknown exception it terminates with sys.exit(2)
When the exception is raised by GitPython I see that I land in the following line (although my application is running on Linux):
call(("TASKKILL /F /T /PID %s 2>nul 1>nul" % str(proc.pid)), shell=True)
Here I get the following exception (not always but in some cases):
Exception ignored in: <bound method GitRepository.del of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/home/srei/work/git/GitPython/git/repo/base.py", line 182, in del
File "/home/srei/work/git/GitPython/git/cmd.py", line 965, in clear_cache
File "/home/srei/work/git/GitPython/git/cmd.py", line 265, in del
File "/usr/lib/python3.4/subprocess.py", line 537, in call
TypeError: 'NoneType' object is not callable
I took a look at the attribute error exception: it was the following:
'NoneType' object has no attribute 'SIGTERM'
I fixed this problem by wrapping the call line in a try: except block
However there remained another problem (that happened also only in rare cases):
Exception ignored in: <bound method GitRepository.del of <GitRepository '/big/yocto/msc-ldk'>>
Traceback (most recent call last):
File "/home/srei/work/git/GitPython/git/repo/base.py", line 182, in del
File "/home/srei/work/git/GitPython/git/cmd.py", line 967, in clear_cache
File "/home/srei/work/git/GitPython/git/cmd.py", line 254, in del
File "/usr/lib/python3.4/subprocess.py", line 1686, in terminate
File "/usr/lib/python3.4/subprocess.py", line 1681, in send_signal
TypeError: an integer is required (got type NoneType)
I fixed this one by adding a general except for proc.terminate and proc.wait
It would be really great when you would merge this improvement. These sporadic tracebacks are really annoying