diff --git a/tool/run b/tool/run index 8372823a0..e74c0fba6 100755 --- a/tool/run +++ b/tool/run @@ -887,24 +887,28 @@ proc spawn_serial { wait_for_re timeout_value kernel_msg } { jtag_load } - # pipe the serial output through 'tr', sometimes expect steps out due to - # unexpected pipe behaviour and reports EOF although the pipe is still active - eval spawn sh -c \"$serial_cmd | tr a a\" - set serial_spawn_id $spawn_id - set timeout 210 - expect { - $kernel_msg { break; } - eof { puts stderr "Serial command process died unexpectedly"; incr retry -1; } - timeout { puts stderr "Boot process timed out"; close; incr retry -1; } + while {true} { + eval spawn $serial_cmd + set serial_spawn_id $spawn_id + expect { + $kernel_msg { + wait_for_output $wait_for_re $timeout_value $serial_spawn_id; + return; + } + eof { continue; } + timeout { + puts stderr "Boot process timed out"; + close; + incr retry -1; + break; + } + } } } - if { $retry == 0 } { - puts stderr "Boot process failed 3 times in series. I give up!"; - exit -1; - } - wait_for_output $wait_for_re $timeout_value $serial_spawn_id + puts stderr "Boot process failed 3 times in series. I give up!"; + exit -1; }