Skip to content

Commit

Permalink
Merge branch 'fix-#396' of https://github.com/rhaschke/catkin_tools i…
Browse files Browse the repository at this point in the history
…nto rhaschke-fix-#396
  • Loading branch information
wjwwood committed Jan 11, 2017
2 parents e5bb5d8 + ced7ecd commit 205bb2d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 8 additions & 2 deletions catkin_tools/execution/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def __init__(
show_summary=True,
show_full_summary=False,
show_repro_cmd=True,
merge_stderr_into_stdout=True,
active_status_rate=10.0,
pre_start_time=None):
"""
Expand All @@ -218,6 +219,7 @@ def __init__(
:param show_summary: Show numbers of jobs that completed with errors and warnings
:param show_full_summary: Show lists of jobs in each termination category
:param show_repro_cmd: Show the commands to reproduce failed stages
:param merge_stderr_into_stdout: Merge stderr output into stdout ?
:param active_status_rate: The rate in Hz at which the status line should be printed
:param pre_start_time: The actual start time to report, if preprocessing was done
"""
Expand All @@ -240,6 +242,7 @@ def __init__(
self.show_full_summary = show_full_summary
self.show_summary = show_summary
self.show_repro_cmd = show_repro_cmd
self.merge_stderr_into_stdout = merge_stderr_into_stdout
self.active_status_rate = active_status_rate
self.pre_start_time = pre_start_time

Expand Down Expand Up @@ -679,6 +682,7 @@ def run(self):
max(0, self.max_jid_length - len(event.data['job_id'])),
event.data['retcode'])

lines_target = sys.stdout
if self.show_buffered_stdout:
if len(event.data['interleaved']) > 0:
lines = [
Expand All @@ -697,6 +701,8 @@ def run(self):
for l in event.data['stderr'].splitlines(True)
if (self.show_compact_io is False or len(l.strip()) > 0)
]
if not self.merge_stderr_into_stdout:
lines_target = sys.stderr
else:
header_border = None
header_title = None
Expand All @@ -713,15 +719,15 @@ def run(self):
if header_title:
wide_log(header_title)
if len(lines) > 0:
wide_log(''.join(lines), end='\r')
wide_log(''.join(lines), end='\r', file=lines_target)
if footer_border:
wide_log(footer_border)
if footer_title:
wide_log(footer_title)

elif 'STDERR' == eid:
if self.show_live_stderr and len(event.data['data']) > 0:
wide_log(self.format_interleaved_lines(event.data), end='\r')
wide_log(self.format_interleaved_lines(event.data), end='\r', file=sys.stderr)

elif 'STDOUT' == eid:
if self.show_live_stdout and len(event.data['data']) > 0:
Expand Down
4 changes: 4 additions & 0 deletions catkin_tools/verbs/catkin_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def build_isolated_workspace(
force_color=False,
quiet=False,
interleave_output=False,
merge_stderr_into_stdout=True,
no_status=False,
limit_status_rate=10.0,
lock_install=False,
Expand Down Expand Up @@ -205,6 +206,8 @@ def build_isolated_workspace(
:type quiet: bool
:param interleave_output: prints the output of commands as they are received
:type interleave_output: bool
:param merge_stderr_into_stdout: Merge stderr output into stdout ?
:type merge_stderr_into_stdout: bool
:param no_status: disables status bar
:type no_status: bool
:param limit_status_rate: rate to which status updates are limited; the default 0, places no limit.
Expand Down Expand Up @@ -527,6 +530,7 @@ def build_isolated_workspace(
show_live_stderr=interleave_output,
show_stage_events=not quiet,
show_full_summary=(summarize_build is True),
merge_stderr_into_stdout=merge_stderr_into_stdout,
pre_start_time=pre_start_time,
active_status_rate=limit_status_rate)
status_thread.start()
Expand Down
3 changes: 3 additions & 0 deletions catkin_tools/verbs/catkin_build/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def prepare_arguments(parser):
help='Print output from commands in ordered blocks once the command finishes.')
add('--interleave-output', '-i', action='store_true', default=False,
help='Prevents ordering of command output when multiple commands are running at the same time.')
add('--split-stderr', '-e', action='store_false', dest='merge_stderr_into_stdout', default=True,
help='Direct stderr output to stderr again, instead of merging it with stdout (which is the default)')
add('--no-status', action='store_true', default=False,
help='Suppresses status line, useful in situations where carriage return is not properly supported.')
add('--summarize', '--summary', '-s', action='store_true', default=None,
Expand Down Expand Up @@ -411,6 +413,7 @@ def main(opts):
force_color=opts.force_color,
quiet=not opts.verbose,
interleave_output=opts.interleave_output,
merge_stderr_into_stdout=opts.merge_stderr_into_stdout,
no_status=opts.no_status,
limit_status_rate=opts.limit_status_rate,
lock_install=not opts.no_install_lock,
Expand Down

0 comments on commit 205bb2d

Please sign in to comment.