tool/run: fix corner case in exit override

The run tool overrides the 'exit'-procedure to make sure that a loaded
run_power_off procedure is always executed. However, a failing
run_power_off lead to false-positives: 'make run/...' exited with 0 even
tough the run script was not even executed because of a failed
power-on/off cycle. In this case, if the run_power_off is the exit code
producer, the new exit definition does not finish as intended. As a
result, the first exit code is re-written, and errors are not propagated
accordingly.

The solution is to catch possible errors from power-off within the exit
procedure.

Fixes genodelabs#5102
This commit is contained in:
Renato Carvalho 2024-01-25 12:06:51 +01:00 committed by Christian Helmuth
parent e31273a410
commit 8c7e90f7f2

View File

@ -958,7 +958,7 @@ proc have_include { name } {
#
rename exit real_exit
proc exit {{status 0}} {
run_power_off
catch {run_power_off}
real_exit $status
}