Compare commits

..

2 commits

Author SHA1 Message Date
dc8b8a535e Fixed message for mode 40 output.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -7s
2024-06-28 18:52:59 +02:00
5051de99fe Fixed reboot watchdog fail safe. 2024-06-28 18:17:54 +02:00

View file

@ -2,7 +2,7 @@
#
# Typically used in combination with the MSX-DOS 'omsxctl.com' utility.
#
# Adds two environment variables and two commands to openMSX;
# Adds two commands to openMSX;
#
# 'fail_after timeout [timeunit] [fail_id] [fail_code]'
# Schedules an openMSX exit after the timeout.
@ -54,17 +54,26 @@ proc fail_after { timeout {time_unit "time"} {fail_id "fail_after"} {fail_code 2
puts stderr "error: $err_msg"
fail_after_exit fail_after_timer_error 1
}
set msg "$msg\n$fail_id: Automatic failure in $timeout $time_unit seconds."
set msg "$msg\n$fail_id: Failure in $timeout $time_unit sec"
} else {
set fail_after_prev_timer 0
}
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
}