Using a .23 build of stgit I could reproduce this every time just by running stg pull:
$ stg pull
Popping all applied patches ... done
Pulling from "origin"
Already up to date.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\src\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\src\Python27\lib\site-packages\stgit\lib\git\repository.py", line 122, in _shutdown
os.kill(self._proc.pid(), signal.SIGTERM)
WindowsError: [Error 5] Access is denied
Error in sys.exitfunc:
Traceback (most recent call last):
File "C:\src\Python27\lib\atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "C:\src\Python27\lib\site-packages\stgit\lib\git\repository.py", line 122, in _shutdown
os.kill(self._proc.pid(), signal.SIGTERM)
WindowsError: [Error 5] Access is denied
I fixed this with the following update:
def _shutdown(self):
if self._proc:
self._proc.stdin.close()
try:
os.kill(self._proc.pid(), signal.SIGTERM)
except OSError:
pass
self._proc.wait()
I believe what's happening here is that the PID is no longer valid and we're trying to kill an already-dead process.