Skip to content

Commit f16b134

Browse files
committed
Added logging of keyboard interrupt and saving of log files
1 parent 10feb17 commit f16b134

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

simvue/executor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,8 @@ def kill_process(
414414
process.kill()
415415
process.wait()
416416

417+
self._save_output()
418+
417419
def kill_all(self) -> None:
418420
"""Kill all running processes"""
419421
for process in self._processes.keys():

simvue/run.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,12 @@ def _handle_exception_throw(
166166
if not _is_running:
167167
return
168168

169-
self.set_status("terminated" if _is_terminated else "failed")
170-
171169
if not self._active:
172170
return
173171

172+
self.log_event(traceback or f"An exception was thrown: {_exception_thrown}")
173+
self.set_status("terminated" if _is_terminated else "failed")
174+
174175
# If the dispatcher has already been aborted then this will
175176
# fail so just continue without the event
176177
with contextlib.suppress(RuntimeError):
@@ -1415,7 +1416,8 @@ def _tidy_run(self) -> None:
14151416
if self._status == "running":
14161417
if self._dispatcher:
14171418
self._dispatcher.join()
1418-
self.set_status("completed")
1419+
if self._active:
1420+
self.set_status("completed")
14191421
elif self._dispatcher:
14201422
self._dispatcher.purge()
14211423
self._dispatcher.join()

0 commit comments

Comments
 (0)