Fix an issue with stdout redirection on Windows, and remove code added in a failed attempt to resolve a Windows regression test issue.

This commit is contained in:
Khushboo Vashi 2019-03-19 15:55:34 +00:00 committed by Dave Page
parent 4dcd3e31d8
commit 546161ab1a
2 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,12 @@ if 'SERVER_MODE' in globals():
else:
builtins.SERVER_MODE = None
# Set null device file path to stdout, stdin, stderr if they are None
for _name in ('stdin', 'stdout', 'stderr'):
if getattr(sys, _name) is None:
setattr(sys, _name, open(os.devnull,
'r' if _name == 'stdin' else 'w'))
import config
from pgadmin import create_app
from pgadmin.utils import u, fs_encoding, file_quote

View File

@ -248,7 +248,7 @@ def create_app(app_name=None):
logger.addHandler(fh)
# Console logging
ch = logging.StreamHandler(sys.stdout.reconfigure(encoding='utf-8'))
ch = logging.StreamHandler()
ch.setLevel(config.CONSOLE_LOG_LEVEL)
ch.setFormatter(logging.Formatter(config.CONSOLE_LOG_FORMAT))
app.logger.addHandler(ch)