Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/grss:master commit in: grs/
Date: Thu, 02 Jul 2015 22:30:43
Message-Id: 1435876371.10a308cef6fecb1d8e3b4ffd932f79d5020bec85.blueness@gentoo
1 commit: 10a308cef6fecb1d8e3b4ffd932f79d5020bec85
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 2 22:32:51 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 2 22:32:51 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/grss.git/commit/?id=10a308ce
7
8 Daemon.py: add kudos.
9
10 grs/Daemon.py | 4 +++-
11 1 file changed, 3 insertions(+), 1 deletion(-)
12
13 diff --git a/grs/Daemon.py b/grs/Daemon.py
14 index 8fed2a1..15290a5 100644
15 --- a/grs/Daemon.py
16 +++ b/grs/Daemon.py
17 @@ -9,6 +9,8 @@ import time
18 class Daemon:
19 """ doc here
20 more doc
21 + Adopted from Sander Marechal's "A simple unix/linux daemon in Python"
22 + See: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
23 """
24
25 def __init__(self, pidfile, **kwargs):
26 @@ -41,7 +43,7 @@ class Daemon:
27 sys.stderr.write('fork #2 failed %s\n' % err)
28 sys.exit(1)
29
30 - # Close stdin, and redirect both stdout and stderr to grs-daemon-<pid>.err
31 + # Dup stdin to /dev/null, and stdout and stderr to grs-daemon-<pid>.err
32 si = open(os.devnull, 'r')
33 os.dup2(si.fileno(), sys.stdin.fileno())