[cfe-commits] r66281 - /cfe/trunk/tools/ccc/ccclib/Driver.py
Daniel Dunbar
daniel at zuster.org
Fri Mar 6 10:32:32 PST 2009
Author: ddunbar
Date: Fri Mar 6 12:32:01 2009
New Revision: 66281
URL: http://llvm.org/viewvc/llvm-project?rev=66281&view=rev
Log:
Tidy file removal cleanup & remove race condition on file existence.
Modified:
cfe/trunk/tools/ccc/ccclib/Driver.py
Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=66281&r1=66280&r2=66281&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Fri Mar 6 12:32:01 2009
@@ -229,19 +229,27 @@
self.executeJobs(args, jobs)
except:
if not args.getLastArg(self.parser.saveTempsOption):
- for f in self.resultFiles:
- # Fail if removing a result fails:
- if os.path.exists(f):
- os.remove(f)
+ # Fail if removing a result fails.
+ self.removeFiles(self.resultFiles, failOnError=True)
raise
finally:
for f in self.tempFiles:
# Ignore failures in removing temporary files
- try:
- os.remove(f)
- except:
- pass
-
+ self.removeFiles(self.resultFiles, failOnError=False)
+
+ def removeFiles(self, fileList, failOnError=False):
+ for f in fileList:
+ try:
+ os.remove(f)
+ except OSError,e:
+ if failOnError:
+ import errno
+ if e.errno != errno.ENOENT:
+ raise
+ except:
+ if failOnError:
+ raise
+
def executeJobs(self, args, jobs):
vArg = args.getLastArg(self.parser.vOption)
for j in jobs.iterjobs():
More information about the cfe-commits
mailing list