summaryrefslogtreecommitdiff
path: root/buildscripts/clang_format.py
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-06-08 15:57:01 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-06-08 18:42:01 -0400
commit8e9a032204dd891b47dc552b0ce90c5c57c2d744 (patch)
tree19129ebb3ff41bbb0fe7cf02ae3ccfbdb4086060 /buildscripts/clang_format.py
parentab4072ea2af7f28d7ed39b78b3e0c59e5928e9ea (diff)
downloadmongo-8e9a032204dd891b47dc552b0ce90c5c57c2d744.tar.gz
SERVER-24355 clang_format leaves temporary files around after a reformat
Diffstat (limited to 'buildscripts/clang_format.py')
-rwxr-xr-xbuildscripts/clang_format.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/buildscripts/clang_format.py b/buildscripts/clang_format.py
index bc38c341048..850832d1563 100755
--- a/buildscripts/clang_format.py
+++ b/buildscripts/clang_format.py
@@ -309,7 +309,16 @@ class ClangFormat(object):
return True
# Update the file with clang-format
- return not subprocess.call([self.path, "--style=file", "-i", file_name])
+ formatted = not subprocess.call([self.path, "--style=file", "-i", file_name])
+
+ # Version 3.8 generates files like foo.cpp~RF83372177.TMP when it formats foo.cpp
+ # on Windows, we must clean these up
+ if sys.platform == "win32":
+ glob_pattern = file_name + "*.TMP"
+ for fglob in glob.glob(glob_pattern):
+ os.unlink(fglob)
+
+ return formatted
def parallel_process(items, func):