Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7359)

Unified Diff: chrome/test/chromedriver/run_buildbot_steps.py

Issue 1844743002: [chromedriver] Only delete temp files that start with "chromedriver_". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/chromedriver/util.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/run_buildbot_steps.py
diff --git a/chrome/test/chromedriver/run_buildbot_steps.py b/chrome/test/chromedriver/run_buildbot_steps.py
index 4c1cee2d69036873f92a3fa409bc4b941446983f..bf973fb019f64e8183db0f631be9f19edb240922 100755
--- a/chrome/test/chromedriver/run_buildbot_steps.py
+++ b/chrome/test/chromedriver/run_buildbot_steps.py
@@ -385,12 +385,13 @@ def _CleanTmpDir():
print 'cleaning temp directory:', tmp_dir
for file_name in os.listdir(tmp_dir):
file_path = os.path.join(tmp_dir, file_name)
- if os.path.isdir(file_path):
- print 'deleting sub-directory', file_path
- shutil.rmtree(file_path, True)
if file_name.startswith('chromedriver_'):
- print 'deleting file', file_path
- os.remove(file_path)
+ if os.path.isdir(file_path):
+ print 'deleting sub-directory', file_path
+ shutil.rmtree(file_path, True)
+ else:
+ print 'deleting file', file_path
+ os.remove(file_path)
def _GetCommitPositionFromGitHash(snapshot_hashcode):
@@ -497,6 +498,13 @@ def main():
_CleanTmpDir()
+ # Make sure any subprocesses (i.e. chromedriver) create temp files under
+ # $TMPDIR/chromedriver_*, so that they can be cleaned up by _CleanTempDir().
+ if util.IsWindows():
+ os.environ['TMP'] = os.environ['TEMP'] = util.MakeTempDir()
+ else:
+ os.environ['TMPDIR'] = util.MakeTempDir()
+
if not options.revision:
commit_position = None
else:
« no previous file with comments | « no previous file | chrome/test/chromedriver/util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698