Add more possible error handling for sane exit in idlerpg. - annna - Annna the … | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 12e7b1578baa6472c41fb86cf5a17561f9422ba4 | |
parent b078e0710d6543cab2e891ec0825ba5ead7562d9 | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
diff --git a/modules/idlerpg/idlerpg-channel-service.py b/modules/idlerpg/idler… | |
@@ -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. |