diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-06-30 15:38:16 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-06-30 15:38:16 +0000 |
| commit | 829fd5a9670a581309797f56bfc7e5140550e873 (patch) | |
| tree | 6efe30b93fd5fc6564392f1dbaaf04c95a4b6bc2 /django/utils | |
| parent | c349ba4cfc2d137da393bddbda6e78fdb98c9c81 (diff) | |
newforms-admin: Merged from trunk up to [7808]. Fixed #7519, #7573
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/daemonize.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/django/utils/daemonize.py b/django/utils/daemonize.py index f0c2f684bd..68e5392d89 100644 --- a/django/utils/daemonize.py +++ b/django/utils/daemonize.py @@ -2,7 +2,8 @@ import os import sys if os.name == 'posix': - def become_daemon(our_home_dir='.', out_log='/dev/null', err_log='/dev/null'): + def become_daemon(our_home_dir='.', out_log='/dev/null', + err_log='/dev/null', umask=022): "Robustly turn into a UNIX daemon, running in our_home_dir." # First fork try: @@ -13,7 +14,7 @@ if os.name == 'posix': sys.exit(1) os.setsid() os.chdir(our_home_dir) - os.umask(0) + os.umask(umask) # Second fork try: @@ -32,13 +33,13 @@ if os.name == 'posix': # Set custom file descriptors so that they get proper buffering. sys.stdout, sys.stderr = so, se else: - def become_daemon(our_home_dir='.', out_log=None, err_log=None): + def become_daemon(our_home_dir='.', out_log=None, err_log=None, umask=022): """ If we're not running under a POSIX system, just simulate the daemon mode by doing redirections and directory changing. """ os.chdir(our_home_dir) - os.umask(0) + os.umask(umask) sys.stdin.close() sys.stdout.close() sys.stderr.close() |
