Description: Python 3 fixes (2to3) and shlex.quote instead of pipes.quote
  (pipes was removed in Python 3.13).
Issue ID: none
Changeset: none
TODO: Upstream is dead (last release 0.0.15 in 2014, no repository); keep
  locally.

--- daemon_runner.py.orig	2014-04-28 21:03:22 UTC
+++ daemon_runner.py
@@ -3,7 +3,7 @@ import os
 import sys
 import time
 import fcntl
-import pipes
+import shlex
 import errno
 import daemon
 import signal
@@ -59,7 +59,7 @@ process = [None]
 
 
 def exec_process(args):
-    os.execl('/bin/sh', '/bin/sh', '-c', ' '.join(pipes.quote(arg) for arg in args.command))
+    os.execl('/bin/sh', '/bin/sh', '-c', ' '.join(shlex.quote(arg) for arg in args.command))
 
 
 def watch_process(args, pid_file=None):
@@ -68,7 +68,7 @@ def watch_process(args, pid_file=None):
 
     try:
         pidfile = acquire_pidfile_lock(pid_file)
-    except Exception, e:
+    except Exception as e:
         sys.stderr.write("Couldn't acquire pidfile lock {0}, owned by {1} ({2})\n".format(pid_file, get_pid(pid_file), e))
         sys.exit(1)
 
@@ -78,7 +78,7 @@ def watch_process(args, pid_file=None):
         stdin = sys.stdin
 
     try:
-        process[0] = subprocess.Popen(' '.join(pipes.quote(arg) for arg in args.command),
+        process[0] = subprocess.Popen(' '.join(shlex.quote(arg) for arg in args.command),
                                       shell=True, stdin=stdin)
         p = process[0]
         pid = p.pid
@@ -161,7 +161,7 @@ def get_uid(user):
         return int(user)
     except ValueError:
         pass
-    uid = subprocess.Popen("id -u {0}".format(pipes.quote(user)),
+    uid = subprocess.Popen("id -u {0}".format(shlex.quote(user)),
                            shell=True,
                            stdout=subprocess.PIPE).communicate()[0]
     try:
