Skip to content

Commit

Permalink
remove option for merging stderr to stdout
Browse files Browse the repository at this point in the history
default is now to output errors to stderr always
  • Loading branch information
wjwwood committed Jan 13, 2017
1 parent f3d672e commit 426af25
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
25 changes: 16 additions & 9 deletions catkin_tools/execution/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ 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 @@ -219,7 +218,6 @@ 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 @@ -242,7 +240,6 @@ 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 @@ -629,10 +626,14 @@ def run(self):
del active_stages[event.data['job_id']]

header_border = None
header_border_file = sys.stdout
header_title = None
header_title_file = sys.stdout
lines = []
footer_title = None
footer_title_file = sys.stdout
footer_border = None
footer_border_file = sys.stdout

# Generate headers / borders for output
if event.data['succeeded']:
Expand All @@ -648,12 +649,15 @@ def run(self):

# Output contains warnings
header_border = clr('@!@{yf}' + '_' * (terminal_width() - 1) + '@|')
header_border_file = sys.stderr
header_title = clr(
'Warnings << {}:{} {}').format(
event.data['job_id'],
event.data['stage_label'],
event.data['logfile_filename'])
header_title_file = sys.stderr
footer_border = clr('@{yf}' + '.' * (terminal_width() - 1) + '@|')
footer_border_file = sys.stderr
else:
# Normal output, no warnings
header_title = clr(
Expand All @@ -668,19 +672,23 @@ def run(self):
else:
# Output contains errors
header_border = clr('@!@{rf}' + '_' * (terminal_width() - 1) + '@|')
header_border_file = sys.stderr
header_title = clr(
'Errors << {}:{} {}').format(
event.data['job_id'],
event.data['stage_label'],
event.data['logfile_filename'])
header_title_file = sys.stderr
footer_border = clr('@{rf}' + '.' * (terminal_width() - 1) + '@|')
footer_border_file = sys.stderr

footer_title = clr(
'Failed << {}:{:<{}} [ Exited with code {} ]').format(
event.data['job_id'],
event.data['stage_label'],
max(0, self.max_jid_length - len(event.data['job_id'])),
event.data['retcode'])
footer_title_file = sys.stderr

lines_target = sys.stdout
if self.show_buffered_stdout:
Expand All @@ -701,8 +709,7 @@ 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
lines_target = sys.stderr
else:
header_border = None
header_title = None
Expand All @@ -715,15 +722,15 @@ def run(self):

# Print the output
if header_border:
wide_log(header_border)
wide_log(header_border, file=header_border_file)
if header_title:
wide_log(header_title)
wide_log(header_title, file=header_title_file)
if len(lines) > 0:
wide_log(''.join(lines), end='\r', file=lines_target)
if footer_border:
wide_log(footer_border)
wide_log(footer_border, file=footer_border_file)
if footer_title:
wide_log(footer_title)
wide_log(footer_title, file=footer_title_file)

elif 'STDERR' == eid:
if self.show_live_stderr and len(event.data['data']) > 0:
Expand Down
4 changes: 0 additions & 4 deletions catkin_tools/verbs/catkin_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ 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 @@ -206,8 +205,6 @@ 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 @@ -530,7 +527,6 @@ 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: 0 additions & 3 deletions catkin_tools/verbs/catkin_build/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ 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 @@ -413,7 +411,6 @@ 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 426af25

Please sign in to comment.