>From 0c9f764be019d25a7ac1274abd16ea05767c3d2a Mon Sep 17 00:00:00 2001 From: Martin Schlemmer Date: Thu, 12 Jul 2012 12:44:10 +0200 Subject: [PATCH 3/3] Windows port: handle failure to unlink the temporary directory more gracefully On MinGW/MSYS unlinking the temporary directory the first time do not always succeed the first time because of what seems to be AV-scanner activity on the created executable. This causes Python to throw an exception, and due to some strange interaction between MSYS and Python, an artificial lockup is caused. Pressing return in mintty prints the exception and continues. This is with Python 2.7 from www.python.org. --- giscanner/gdumpparser.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index c0b13f4..ae30e57 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -23,6 +23,7 @@ import sys import tempfile import shutil import subprocess +import time from xml.etree.cElementTree import parse from . import ast @@ -171,7 +172,14 @@ 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) + # FIXME: MinGW/MSYS do not always remove the directory the first time, + # causing lockups due to what seems to be interaction between + # MSYS and python when an exception is caught ... + try: + shutil.rmtree(self._binary.tmpdir) + except Exception, e: + time.sleep(0.5) + shutil.rmtree(self._binary.tmpdir, True) # Parser -- 1.7.11.msysgit.1