esac
}
+manage () {
+ local when=$(date +%s) now
+ local fail=0 rc report
+
+ while :; do
+ "$@"; rc=$?
+ case $rc in
+ 0) info "manage $1: successful exit"; break ;;
+ 143) info "manage $1: terminated"; break ;;
+ esac
+ now=$(date +%s)
+ report="rc = $rc"
+ if (( $now - $when > 5 )); then
+ fail=0
+ else
+ report="$report, early failure"
+ fail=$(( $fail + 1 ))
+ if (( $fail >= 5 )); then
+ info "manage $1: exit ($report), giving up after $fail failures"
+ break
+ fi
+ fi
+ info "manage $1: exit ($report), restarting"
+ when=$now
+ done
+}
+
## Program choice
pick_program () {
local what=$1; shift
esac
start-e16 () {
- run bginit $wm $wmopts
+ run bginit manage $wm $wmopts
win=nil
for i in $(seq 10); do
sleep 1
start-$wm $wmopts
;;
*)
- run bginit $wm $wmopts
+ run bginit manage $wm $wmopts
;;
esac
}
start-emacs () {
GDK_NATIVE_WINDOWS=1 run bgclients noip \
- $emacs -geometry ${emacsx}x${emacsy}+0+0
+ $emacs -bg black -geometry ${emacsx}x${emacsy}+0+0
}
## Now place some xterms.
exec "$0" wait nostart
;;
:ask-run)
- req "Shell command" .cmd.hist xcatch -FMiscFixed6x13 -- sh -c&
+ req "Shell command" .cmd.hist xcatch -F"Fixed 13" -- sh -c&
;;
:ask-command)
req "xinit command" .xinit.hist xatom set XINIT_COMMAND$atomtag&