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

Unified Diff: gclient_utils.py

Issue 18851005: Print time of long running hook actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Pretty print command, escape for shells. Created 7 years, 5 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 | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index d86f23c1d140466ec7acd435907811f23ba4b9b4..80e2b207c872ea49a7119239547b380c8560334d 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -7,6 +7,7 @@
import codecs
import logging
import os
+import pipes
import Queue
import re
import stat
@@ -182,6 +183,11 @@ def safe_makedirs(tree):
raise
+def CommandToStr(args):
+ """Converts an arg list into a shell escaped string."""
+ return ' '.join(pipes.quote(arg) for arg in args)
+
+
def CheckCallAndFilterAndHeader(args, always=False, header=None, **kwargs):
"""Adds 'header' support to CheckCallAndFilter.
@@ -192,7 +198,7 @@ def CheckCallAndFilterAndHeader(args, always=False, header=None, **kwargs):
stdout = kwargs.setdefault('stdout', sys.stdout)
if header is None:
header = "\n________ running '%s' in '%s'\n" % (
- ' '.join(args), kwargs.get('cwd', '.'))
+ CommandToStr(args), kwargs.get('cwd', '.'))
if always:
stdout.write(header)
« no previous file with comments | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698