diff options
author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-28 01:47:49 +0200 |
---|---|---|
committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-09-28 03:35:39 +0200 |
commit | cf2335af23fb693549d6c4e72b65f97afddc5f64 (patch) | |
tree | 4198d6dd1dccc7608eccabd90367edb17f2e4b1c /git/util.py | |
parent | a5db3d3c49ebe559cb80983d7bb855d4adf1b887 (diff) | |
download | gitpython-cf2335af23fb693549d6c4e72b65f97afddc5f64.tar.gz |
Win, hook, #519: Consume Hook Popen-proc out of GIL
+ HookException thrown on Popen, and were missed on Windows.
+ No SHELL on Popen??
+ Minor fixes:
+ Try harder to delete trees - no remorses.
+ Simplify exception reprs.
+ Unittest-ize test_index assertions.
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/git/util.py b/git/util.py index eb5a6ac1..9faa8eff 100644 --- a/git/util.py +++ b/git/util.py @@ -62,14 +62,12 @@ def rmtree(path): :note: we use shutil rmtree but adjust its behaviour to see whether files that couldn't be deleted are read-only. Windows will not remove them in that case""" + def onerror(func, path, exc_info): - if not os.access(path, os.W_OK): - # Is the error an access error ? - os.chmod(path, stat.S_IWUSR) - func(path) - else: - raise FileExistsError("Cannot delete '%s'", path) - # END end onerror + # Is the error an access error ? + os.chmod(path, stat.S_IWUSR) + func(path) # Will scream if still not possible to delete. + return shutil.rmtree(path, False, onerror) @@ -151,6 +149,7 @@ def get_user_id(): def finalize_process(proc, **kwargs): """Wait for the process (clone, fetch, pull or push) and handle its errors accordingly""" + ## TODO: No close proc-streams?? proc.wait(**kwargs) #} END utilities |