diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-06-20 08:08:03 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-06-20 08:08:03 +0200 |
commit | 7c6adf533001e214e63d284a1a00fa254b29d7b9 (patch) | |
tree | 879c619e4e6b366dc7d523d35c3690e23b58680c /giscanner/gdumpparser.py | |
parent | d3a9346d5056c8da4d5261ed47bc5d52ace84aa8 (diff) | |
download | gobject-introspection-7c6adf533001e214e63d284a1a00fa254b29d7b9.tar.gz |
Add utils.rmtree() which waits and tries again if a file is still in use
On Windows the dumper cleanup regularely fails because the created .exe
is still in use by some process and shutil.rmtree() fails with:
OSError: [WinError 145] The directory is not empty
I'm not 100% sure what's the cause for this, but searching for similar issues
suggests that it might be Windows Defender scanning the newly created .exe
file and because it's so short lifed the scanning and deleting conflict.
This adds a helper which tries a few times and waits a bit before giving up.
A similar patch has been in MSYS2 for some time:
https://github.com/Alexpux/MINGW-packages/blob/d0c39af02a669e45272c713e912ee63b0dd94157/mingw-w64-gobject-introspection/0025-more-tolerant-rmtreeing.patch
Diffstat (limited to 'giscanner/gdumpparser.py')
-rw-r--r-- | giscanner/gdumpparser.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index bd4d233a..cd9d94d2 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -26,7 +26,6 @@ from __future__ import unicode_literals import os import sys import tempfile -import shutil import subprocess from xml.etree.cElementTree import parse @@ -181,7 +180,7 @@ blob containing data gleaned from GObject's primitive introspection.""" return parse(out_path) finally: if not utils.have_debug_flag('save-temps'): - shutil.rmtree(self._binary.tmpdir) + utils.rmtree(self._binary.tmpdir) # Parser |