Compare commits
2 commits
40fe6ae015
...
dc8b8a535e
| Author | SHA1 | Date | |
|---|---|---|---|
| dc8b8a535e | |||
| 5051de99fe |
1 changed files with 13 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue