Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ducktape/cluster/remoteaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,22 @@ def ssh_capture(self, cmd, allow_fail=False, callback=None, combine_stderr=True,

def output_generator():

stdout_lines = []
for line in iter(stdout.readline, ''):

stdout_lines.append(line)
if callback is None:
yield line
else:
yield callback(line)
try:
exit_status = stdout.channel.recv_exit_status()
if exit_status != 0:
full_output = "stderr: {}\nstdout: {}".format(stderr.read(), ''.join(stdout_lines))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only nit would be if we want to have some sort of (both easily parseable and visually compelling) delineator between these two output streams. E.g.

===== stderr ===
...
==== stdout ===
...

if not allow_fail:
raise RemoteCommandError(self, cmd, exit_status, stderr.read())
raise RemoteCommandError(self, cmd, exit_status, full_output)
else:
self._log(logging.DEBUG, "Running ssh command '%s' exited with status %d and message: %s" %
(cmd, exit_status, stderr.read()))
(cmd, exit_status, full_output))
finally:
stdin.close()
stdout.close()
Expand Down