diff options
author | Graham Dumpleton <Graham.Dumpleton@gmail.com> | 2015-10-10 21:48:29 +1100 |
---|---|---|
committer | Graham Dumpleton <Graham.Dumpleton@gmail.com> | 2015-10-10 21:48:29 +1100 |
commit | a3b39d35b909001f1ce673fd0f76c95bfda4dc2d (patch) | |
tree | d25b1343e8eea2309a484c66daa66b126d74214f | |
parent | 28d82a121959ec8d257e8125c82c0280e6f317aa (diff) | |
download | mod_wsgi-a3b39d35b909001f1ce673fd0f76c95bfda4dc2d.tar.gz |
Attempt redirection of startup log to /dev/tty of /dev/stderr cannot be opened.
-rw-r--r-- | docs/release-notes/version-4.4.16.rst | 8 | ||||
-rw-r--r-- | src/server/__init__.py | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/docs/release-notes/version-4.4.16.rst b/docs/release-notes/version-4.4.16.rst index eab5df4..d739abf 100644 --- a/docs/release-notes/version-4.4.16.rst +++ b/docs/release-notes/version-4.4.16.rst @@ -9,3 +9,11 @@ Version 4.4.16 of mod_wsgi can be obtained from: For details on the availability of Windows binaries see: https://github.com/GrahamDumpleton/mod_wsgi/tree/master/win32 + +Bugs Fixed +---------- + +1. If ``/dev/stderr`` cannot be opened for writing when startup log is +requested and logging to the terminal, then ``mod_wsgi-express`` would +fail. Now attempt fallback to using ``/dev/tty`` and if that cannot be +opened either, then give up on trying to use terminal for startup log. diff --git a/src/server/__init__.py b/src/server/__init__.py index b3c611c..4b92589 100644 --- a/src/server/__init__.py +++ b/src/server/__init__.py @@ -2799,12 +2799,19 @@ def _cmd_setup_server(command, args, options): with open('/dev/stderr', 'w'): pass except IOError: - options['startup_log_file'] = None + try: + with open('/dev/tty', 'w'): + pass + except IOError: + options['startup_log_file'] = None + else: + options['startup_log_file'] = '/dev/tty' else: options['startup_log_file'] = '/dev/stderr' - options['httpd_arguments_list'].append('-E') - options['httpd_arguments_list'].append(options['startup_log_file']) + if options['startup_log_file']: + options['httpd_arguments_list'].append('-E') + options['httpd_arguments_list'].append(options['startup_log_file']) if options['server_name']: host = options['server_name'] |