Skip to content

Commit

Permalink
Merge pull request #1446 from xbello/master
Browse files Browse the repository at this point in the history
Added initgroups to work with python-daemon >= 2.1.0.
  • Loading branch information
Tarrasch committed Dec 3, 2015
2 parents 40564a8 + dd5cbf3 commit d366a63
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions luigi/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,20 @@ def daemonize(cmd, pidfile=None, logdir=None, api_port=8082, address=None, unix_
stdout_proxy = open(stdout_path, 'a+')
stderr_proxy = open(stderr_path, 'a+')

ctx = daemon.DaemonContext(
stdout=stdout_proxy,
stderr=stderr_proxy,
working_directory='.'
)
try:
ctx = daemon.DaemonContext(
stdout=stdout_proxy,
stderr=stderr_proxy,
working_directory='.',
initgroups=False,
)
except TypeError:
# Older versions of python-daemon cannot deal with initgroups arg.
ctx = daemon.DaemonContext(
stdout=stdout_proxy,
stderr=stderr_proxy,
working_directory='.',
)

with ctx:
loghandler = get_spool_handler(log_path)
Expand Down

0 comments on commit d366a63

Please sign in to comment.