From 5051de99fef8a4ca1625d7abc46e5ebba4a47483 Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 28 Jun 2024 18:17:54 +0200 Subject: [PATCH] Fixed reboot watchdog fail safe. --- lib/openmsx/share/scripts/fail_after.tcl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/openmsx/share/scripts/fail_after.tcl b/lib/openmsx/share/scripts/fail_after.tcl index 8e590d9..54526cd 100644 --- a/lib/openmsx/share/scripts/fail_after.tcl +++ b/lib/openmsx/share/scripts/fail_after.tcl @@ -61,10 +61,19 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2 return $msg } +proc fail_after_reboot_watchdog {} { + global fail_after_boot_timeout + if {$fail_after_boot_timeout != 0} { + fail_after $fail_after_boot_timeout realtime failed_boot 124 + after boot "fail_after_reboot_watchdog" + } +} + # Globals set fail_after_prev_timer 0 set fail_after_prev_id 0 set fail_after_path 0 +set fail_after_boot_timeout 0 # Parse screenshot path env setting if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH)] != "")} { @@ -73,5 +82,6 @@ if {[info exists ::env(FAIL_AFTER_PATH)] && ([string trim $::env(FAIL_AFTER_PATH # Enables boot watch dog timer when FAIL_AFTER_BOOT env has a value. (124 see `man timeout`) if {[info exists ::env(FAIL_AFTER_BOOT)] && ([string trim $::env(FAIL_AFTER_BOOT)] != "")} { - fail_after [string trim $::env(FAIL_AFTER_BOOT)] realtime failed_boot 124 + set fail_after_boot_timeout [string trim $::env(FAIL_AFTER_BOOT)] + fail_after_reboot_watchdog }