Skip to content

Commit

Permalink
Fixing #3592 - output diagnostic messages to stderr, not stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
ztane committed Jun 1, 2020
1 parent 0a9d140 commit 6280ff1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/pyramid/scripts/pserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, argv, quiet=False, original_ignore_files=None):

def out(self, msg): # pragma: no cover
if self.args.verbose > 0:
print(msg)
print(msg, file=sys.stderr)

def get_config_path(self, loader):
return os.path.abspath(loader.uri.path)
Expand Down Expand Up @@ -296,7 +296,10 @@ def wsgiref_server_runner(wsgi_app, global_conf, **kw): # pragma: no cover
host = kw.get('host', '0.0.0.0')
port = int(kw.get('port', 8080))
server = make_server(host, port, wsgi_app)
print('Starting HTTP server on http://%s:%s' % (host, port))
print(
'Starting HTTP server on http://%s:%s' % (host, port),
file=sys.stderr
)
server.serve_forever()


Expand Down Expand Up @@ -416,10 +419,14 @@ def cherrypy_server_runner(
if host == '0.0.0.0':
print(
'serving on 0.0.0.0:%s view at %s://127.0.0.1:%s'
% (port, protocol, port)
% (port, protocol, port),
file=sys.stderr
)
else:
print('serving on %s://%s:%s' % (protocol, host, port))
print(
'serving on %s://%s:%s' % (protocol, host, port),
file=sys.stderr
)
server.start()
except (KeyboardInterrupt, SystemExit):
server.stop()
Expand Down

0 comments on commit 6280ff1

Please sign in to comment.