changeset 20:94f3b22beec9 draft

use polling in non-fork mode to catch KeyboardInterrupt Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author Changaco <changaco ατ changaco δοτ net>
date Mon, 30 Apr 2012 02:20:34 +0200
parents f22369c00480
children 3ecfeaba3c92
files feed-push
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/feed-push
+++ b/feed-push
@@ -319,5 +319,13 @@ if __name__ == '__main__':
         os.chdir(global_args.config)
         monitor.watch_directory(global_args.config, handler(handle_config_change))
 
-    while True:
-        monitor.handle_one_event()
+    if global_args.fork:
+        while True:
+            monitor.handle_one_event()
+    else:
+        try:
+            while True:
+                monitor.handle_events()
+                time.sleep(1)
+        except KeyboardInterrupt:
+            exit(0)