From 5515655982b209e42bde42b1bafc267249d91043 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Fri, 21 Oct 2011 12:48:25 +0000 Subject: [PATCH] Fix subprocess2.Popen() logging when given a string R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8361006 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@106706 0039d316-1c4b-4281-b951-d872f2087c98 --- subprocess2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/subprocess2.py b/subprocess2.py index 034463fd20..4708aadf36 100644 --- a/subprocess2.py +++ b/subprocess2.py @@ -158,7 +158,12 @@ def Popen(args, **kwargs): # with a list because it only tries to execute the first item in the list. kwargs['shell'] = bool(sys.platform=='win32') - tmp_str = ' '.join(args) + if isinstance(args, basestring): + tmp_str = args + elif isinstance(args, (list, tuple)): + tmp_str = ' '.join(args) + else: + raise CalledProcessError(None, args, kwargs.get('cwd'), None, None) if kwargs.get('cwd', None): tmp_str += '; cwd=%s' % kwargs['cwd'] logging.debug(tmp_str)