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

Unified Diff: win_toolchain/get_toolchain_if_necessary.py

Issue 146583012: win_toolchain: add timeout before nuke, hide taskkill output (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: . Created 6 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: win_toolchain/get_toolchain_if_necessary.py
diff --git a/win_toolchain/get_toolchain_if_necessary.py b/win_toolchain/get_toolchain_if_necessary.py
index 446a801634d19379751f9f781819fc468b778bd3..3ac6689c695f654f9cc2e151db969b86287c7b2c 100755
--- a/win_toolchain/get_toolchain_if_necessary.py
+++ b/win_toolchain/get_toolchain_if_necessary.py
@@ -32,6 +32,7 @@ import json
import os
import subprocess
import sys
+import time
BASEDIR = os.path.dirname(os.path.abspath(__file__))
@@ -128,6 +129,18 @@ def HaveSrcInternalAccess():
shell=True, stdin=nul, stdout=nul, stderr=nul) == 0
+def DelayBeforeRemoving(target_dir):
+ """A grace period before deleting the out of date toolchain directory."""
+ if (os.path.isdir(target_dir) and
+ not bool(int(os.environ.get('CHROME_HEADLESS', '0')))):
+ for i in range(9, 0, -1):
+ sys.stdout.write(
+ '\rRemoving old toolchain in %ds... (Ctrl-C to cancel)' % i)
+ sys.stdout.flush()
+ time.sleep(1)
+ print
+
+
def main():
if not sys.platform.startswith(('cygwin', 'win32')):
return 0
@@ -158,8 +171,13 @@ def main():
HaveSrcInternalAccess())
print('Windows toolchain out of date or doesn\'t exist, updating (%s)...' %
('Pro' if should_get_pro else 'Express'))
+ print(' current_hash: %s' % current_hash)
+ print(' desired_hashes: %s' % desired_hashes)
+ DelayBeforeRemoving(target_dir)
# This stays resident and will make the rmdir below fail.
- subprocess.call(['taskkill', '/f', '/im', 'mspdbsrv.exe'])
+ with open(os.devnull, 'wb') as nul:
+ subprocess.call(['taskkill', '/f', '/im', 'mspdbsrv.exe'],
+ stdin=nul, stdout=nul, stderr=nul)
if os.path.isdir(target_dir):
subprocess.check_call('rmdir /s/q "%s"' % target_dir, shell=True)
args = [sys.executable,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698