hghave: fix 'rmcwd' to ensure temporary directory is removed stable
authorYuya Nishihara <yuya@tcha.org>
Tue, 01 Nov 2016 21:14:33 +0900
branchstable
changeset 30242 389cbfe63586
parent 30241 cac4ca036dff
child 30243 7b7bd704adbd
hghave: fix 'rmcwd' to ensure temporary directory is removed On platforms where cwd can't be removed, it should try rmdir() after chdir to the original cwd.
tests/hghave.py
--- a/tests/hghave.py	Mon Oct 31 13:43:48 2016 +0100
+++ b/tests/hghave.py	Tue Nov 01 21:14:33 2016 +0900
@@ -360,6 +360,11 @@
         return False
     finally:
         os.chdir(ocwd)
+        # clean up temp dir on platforms where cwd can't be removed
+        try:
+            os.rmdir(temp)
+        except OSError:
+            pass
 
 @check("tla", "GNU Arch tla client")
 def has_tla():