From 01c5226ef1ab90df1a8100f6d5963824561cf5f7 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 4 Sep 2013 12:06:35 +0200 Subject: [PATCH] tool/run: Let grep_output strip colors from output --- tool/run | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tool/run b/tool/run index 1b76f0d7b6..c65eac9876 100755 --- a/tool/run +++ b/tool/run @@ -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 {