show the cwd for commands before running them

If the caller passes a cwd value, display it before showing the
command and running it.

Change-Id: I3f50da28f660dcb0ef9f52b707079ed24ca89ce2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-03-10 18:57:51 -05:00
parent f942b9e076
commit 5420e23870
1 changed files with 4 additions and 0 deletions

View File

@ -38,6 +38,8 @@ def check_call(*popenargs, timeout=None, **kwargs):
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
if 'cwd' in kwargs:
LOG.debug('cwd = {}'.format(kwargs['cwd']))
LOG.debug('$ {}'.format(' '.join(cmd)))
completed = subprocess.run(*popenargs, **kwargs)
@ -65,6 +67,8 @@ def check_output(*popenargs, timeout=None, **kwargs):
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
if 'cwd' in kwargs:
LOG.debug('cwd = {}'.format(kwargs['cwd']))
LOG.debug('$ {}'.format(' '.join(cmd)))
if 'stderr' not in kwargs: