#460 exit on UI crash

This commit is contained in:
Mikayla Fischler 2024-04-07 20:55:07 -04:00
parent 45573be8c7
commit f734c4307b
2 changed files with 8 additions and 3 deletions

View File

@ -144,7 +144,7 @@ local function main()
---@class crd_state
crd_state = {
fp_ok = false,
ui_ok = false,
ui_ok = true, -- default true, used to abort on fail
link_fail = false,
shutdown = false
},

View File

@ -190,16 +190,21 @@ function threads.thread__main(smem)
sounder.continue()
end
-- check for termination request
-- check for termination request or UI crash
if event == "terminate" or ppm.should_terminate() then
crd_state.shutdown = true
log.info("terminate requested, main thread exiting")
elseif not crd_state.ui_ok then
crd_state.shutdown = true
log.info("terminating due to fatal UI error")
end
if crd_state.shutdown then
-- handle closing supervisor connection
coord_comms.try_connect(true)
if coord_comms.is_linked() then
log_comms("terminate requested, closing supervisor connection...")
log_comms("closing supervisor connection...")
else crd_state.link_fail = true end
coord_comms.close()