mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Handle abort in exclusive output state correctly
If the event loop is stopped while something holds the exclusive output, the "log" singleton is now reset so the main thread can print a few more messages before exiting.
This commit is contained in:
@ -115,11 +115,11 @@ def main() -> None:
|
||||
dump_config(args, config)
|
||||
exit()
|
||||
|
||||
# TODO Unset exclusive output on exceptions (if it was being held)
|
||||
pferd = Pferd(config)
|
||||
try:
|
||||
asyncio.run(pferd.run())
|
||||
except KeyboardInterrupt:
|
||||
log.unlock()
|
||||
log.explain_topic("Interrupted, exiting immediately")
|
||||
log.explain("Open files and connections are left for the OS to clean up")
|
||||
log.explain("Temporary files are not cleaned up")
|
||||
@ -128,5 +128,6 @@ def main() -> None:
|
||||
# reconsider what exit code to use here.
|
||||
exit(1)
|
||||
except Exception:
|
||||
log.unlock()
|
||||
log.unexpected_exception()
|
||||
exit(1)
|
||||
|
Reference in New Issue
Block a user