diff --git a/src/uitext.ml b/src/uitext.ml index 8b20ece01..a2aaccf97 100644 --- a/src/uitext.ml +++ b/src/uitext.ml @@ -1641,6 +1641,15 @@ let rec start interface = from here onwards are treated as potentially temporary or recoverable. The process does not have to exit if in repeat mode and can try again. *) and start2 () = + let noRepeat = + Prefs.read Uicommon.repeat = `NoRepeat + || Prefs.read Uicommon.runtests + || Prefs.read Uicommon.testServer + in + let terminate () = + handleException Sys.Break; + exit Uicommon.fatalExit + in begin try Uicommon.connectRoots ~displayWaitMessage (); @@ -1664,14 +1673,9 @@ and start2 () = (* Put the terminal back in "sane" mode, if necessary, and quit. *) restoreTerminal(); exit exitStatus - with - Sys.Break -> begin - (* If we've been killed, then die *) - handleException Sys.Break; - exit Uicommon.fatalExit - end - | e when breakRepeat e -> begin + | Sys.Break -> terminate () + | e when noRepeat || breakRepeat e -> begin handleException e; exit Uicommon.fatalExit end @@ -1679,13 +1683,10 @@ and start2 () = (* If any other bad thing happened and the -repeat preference is set, then restart *) handleException e; - if Prefs.read Uicommon.repeat = `NoRepeat - || Prefs.read Uicommon.runtests then - exit Uicommon.fatalExit; Util.msg "\nRestarting in 10 seconds...\n\n"; - begin try interruptibleSleep 10 with Sys.Break -> exit Uicommon.fatalExit end; - if safeStopRequested () then exit Uicommon.fatalExit else start2 () + begin try interruptibleSleep 10 with Sys.Break -> terminate () end; + if safeStopRequested () then terminate () else start2 () end end