tool/run: Let grep_output strip colors from output

This commit is contained in:
Norman Feske 2013-09-04 12:06:35 +02:00
parent 5059f2e0b6
commit 01c5226ef1

View File

@ -129,6 +129,24 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id
}
##
# Remove color information from output
#
proc filter_out_color_escape_sequences { } {
global output
regsub -all {\e\[.*?m} $output "" output
}
##
# Remove superfluous empty lines and unify line endings from output
#
proc trim_lines { } {
global output
regsub -all {[\r\n]+} $output "\n" output
}
##
# Filter output based on the specified pattern
#
@ -136,7 +154,11 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id
#
proc grep_output {pattern} {
global output
regsub -all {[\r\n]+} $output "\n" output
filter_out_color_escape_sequences
trim_lines
set output_list [split $output "\n"]
set filtered ""
foreach line $output_list {