Add command to stdout/stderr log.

This commit is contained in:
Darko Poljak 2017-09-18 13:17:38 +02:00 committed by Darko Poljak
parent 8cfa1c37d0
commit 7a3c6f2024
3 changed files with 7 additions and 7 deletions

View File

@ -254,8 +254,8 @@ class Local(object):
output = None
if do_save_output:
util.log_std_fd(self.log, stderr, 'Local stderr')
util.log_std_fd(self.log, stdout, 'Local stdout')
util.log_std_fd(self.log, command, stderr, 'Local stderr')
util.log_std_fd(self.log, command, stdout, 'Local stdout')
return output
except subprocess.CalledProcessError as e:

View File

@ -335,8 +335,8 @@ class Remote(object):
stderr=stderr)
output = None
util.log_std_fd(self.log, stderr, 'Remote stderr')
util.log_std_fd(self.log, stdout, 'Remote stdout')
util.log_std_fd(self.log, command, stderr, 'Remote stderr')
util.log_std_fd(self.log, command, stdout, 'Remote stdout')
return output
except subprocess.CalledProcessError as e:

View File

@ -169,8 +169,8 @@ def get_std_fd(base_path, name):
return stdfd
def log_std_fd(log, stdfd, prefix):
def log_std_fd(log, command, stdfd, prefix):
if stdfd is not None and stdfd != subprocess.DEVNULL:
stdfd.seek(0, 0)
log.trace("{}: {}".format(
prefix, stdfd.read().decode()))
log.trace("Command: {}; {}: {}".format(
command, prefix, stdfd.read().decode()))