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 output = None
if do_save_output: if do_save_output:
util.log_std_fd(self.log, stderr, 'Local stderr') util.log_std_fd(self.log, command, stderr, 'Local stderr')
util.log_std_fd(self.log, stdout, 'Local stdout') util.log_std_fd(self.log, command, stdout, 'Local stdout')
return output return output
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:

View file

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

View file

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