subprocess + python-daemon - bug/problem?

Joel Martin nospam at martintribe.org
Wed Sep 16 23:32:14 CEST 2009


On Sep 8, 5:19 pm, Ben Finney <ben+pyt... at benfinney.id.au> wrote:
> Sewar <xsew... at gmail.com> writes:
> > I looked at other daemon libraries and snippets, it's clearly the bug is in
> > subprocess not python-daemon.
> > Then I found Python bug #1731717 which discusses it.

I'm running python-2.6.2 which supposedly has the fix for #1731717.
However I still still the problem with subprocess after daemonizing.
I've narrowed it down to just the setting of the SIGCLD signal.

You can reproduce the problem thus (in 2.4.6, 2.5.4 and 2.6.2):

import subprocess, signal
signal.signal(signal.SIGCLD, signal.SIG_IGN)
subprocess.Popen(['echo','foo']).wait()


This patch allows python-daemon to work with subprocess:

--- daemon.py       (revision 146)
+++ daemon.py       (working copy)
@@ -140,8 +140,6 @@
             actually defined in the ``signal`` module will appear in
the
             default map:

-            * ``signal.SIGCLD``: ``None``
-
             * ``signal.SIGTTIN``: ``None``

             * ``signal.SIGTTOU``: ``None``
@@ -730,7 +728,6 @@

         """
     name_map = {
-        'SIGCLD': None,
         'SIGTSTP': None,
         'SIGTTIN': None,
         'SIGTTOU': None,



More information about the Python-list mailing list