Add more possible error handling for sane exit in idlerpg. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 12e7b1578baa6472c41fb86cf5a17561f9422ba4 DIR parent b078e0710d6543cab2e891ec0825ba5ead7562d9 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 24 Mar 2024 18:23:10 +0100 Add more possible error handling for sane exit in idlerpg. Diffstat: M modules/idlerpg/idlerpg-channel-se… | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- DIR diff --git a/modules/idlerpg/idlerpg-channel-service.py b/modules/idlerpg/idlerpg-channel-service.py @@ -274,15 +274,22 @@ def main(args): update_hackers_from_users(hackers, users) - inotifywm = pyinotify.WatchManager() - inotifywm.add_watch("%s/out" % (chanpath), pyinotify.IN_MODIFY) + try: + inotifywm = pyinotify.WatchManager() + inotifywm.add_watch("%s/out" % (chanpath), pyinotify.IN_MODIFY) + except: + sys.exit(1) inotifyfd = inotifywm.get_fd() def event_processor(notifier): pass notifier = pyinotify.Notifier(inotifywm, default_proc_fun=event_processor) - chanoutfd = open("%s/out" % (chanpath), "r+") + try: + chanoutfd = open("%s/out" % (chanpath), "r+") + except: + sys.exit(1) + chanoutfd.readlines() while 1: # Game ticks every 5 seconds.