changeset 17:421a3416e768 draft

close std{in,out,err} in daemon mode Signed-off-by: Changaco <changaco ατ changaco δοτ net>
author Changaco <changaco ατ changaco δοτ net>
date Thu, 26 Apr 2012 23:54:23 +0200
parents 183f4f544987
children 868a339b19f8
files feed-push
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/feed-push
+++ b/feed-push
@@ -285,6 +285,10 @@ if __name__ == '__main__':
             global_args.fork.write(str(pid))
             exit(0)
         openlog(facility=LOG_DAEMON)
+        null = open('/dev/null', 'r+')
+        for f in [sys.stdin, sys.stdout, sys.stderr]:
+            f.flush()
+            os.dup2(null.fileno(), f.fileno())
 
     state = {'id_cache': {}}
     saved_state = global_args.state_file.read().strip()