Skip to content

Commit

Permalink
Take stdout redirection out of daemonization for #1096
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch45 committed Jul 29, 2012
1 parent ae5325f commit 63d6e96
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions salt/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,14 @@ def daemonize():
log.error(msg.format(exc.errno, exc.strerror))
sys.exit(1)

dev_null = open('/dev/null', 'rw')
os.dup2(dev_null.fileno(), sys.stdin.fileno())
os.dup2(dev_null.fileno(), sys.stdout.fileno())
os.dup2(dev_null.fileno(), sys.stderr.fileno())
# A normal daemonization redirects the process output to /dev/null.
# Unfortunately when a python multiprocess is called the output is
# not cleanly redirected and the parent process dies when the
# multiprocessing process attemps to access stdout or err.
#dev_null = open('/dev/null', 'rw')
#os.dup2(dev_null.fileno(), sys.stdin.fileno())
#os.dup2(dev_null.fileno(), sys.stdout.fileno())
#os.dup2(dev_null.fileno(), sys.stderr.fileno())


def daemonize_if(opts, **kwargs):
Expand Down

0 comments on commit 63d6e96

Please sign in to comment.