Mercurial > bitten > bitten-test
changeset 549:cb137f2121b9
Only actually run `rmtree` if the root directory exists (fixes #381; patch is from there)
author | dfraser |
---|---|
date | Fri, 03 Apr 2009 07:41:28 +0000 |
parents | e42f5644ea91 |
children | 6a8dcbffdce2 |
files | bitten/slave.py |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/slave.py +++ b/bitten/slave.py @@ -40,11 +40,14 @@ errno.ECONNREFUSED] def _rmtree(root): - """Catch shutil.rmtree failures on Windows when files are read-only.""" + """Catch shutil.rmtree failures on Windows when files are read-only, and only remove if root exists.""" def _handle_error(fn, path, excinfo): os.chmod(path, 0666) fn(path) - return shutil.rmtree(root, onerror=_handle_error) + if os.path.exists(root): + return shutil.rmtree(root, onerror=_handle_error) + else: + return False class SaneHTTPErrorProcessor(urllib2.HTTPErrorProcessor): "The HTTPErrorProcessor defined in urllib needs some love."