Patchwork serve: make sure to print "listening at" message immediately

login
register
mail settings
Submitter Yuya Nishihara
Date June 28, 2014, 5:23 a.m.
Message ID <839ca1a158ea5edf9a65.1403933019@mimosa>
Download mbox | patch
Permalink /patch/5076/
State Accepted
Commit 6b0275e5f27696226595c114c9bf034519aaad45
Headers show

Comments

Yuya Nishihara - June 28, 2014, 5:23 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1403928164 -32400
#      Sat Jun 28 13:02:44 2014 +0900
# Node ID 839ca1a158ea5edf9a65060cf2add3d61793ee3d
# Parent  ecd66e735e0c9320e52f44925fd8d48a682d28a5
serve: make sure to print "listening at" message immediately

If stdout is piped, status message won't be flushed until client connects to
the server and access log is written to stdout.  It seems bad idea to queue
start-up banner of server process.
Pierre-Yves David - June 28, 2014, 10:15 a.m.
On 06/28/2014 07:23 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1403928164 -32400
> #      Sat Jun 28 13:02:44 2014 +0900
> # Node ID 839ca1a158ea5edf9a65060cf2add3d61793ee3d
> # Parent  ecd66e735e0c9320e52f44925fd8d48a682d28a5
> serve: make sure to print "listening at" message immediately

Push to clowncopter, thanks!

(queued)

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5319,6 +5319,7 @@  class httpservice(object):
             write = self.ui.write
         write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
               (fqaddr, port, prefix, bindaddr, self.httpd.port))
+        self.ui.flush()  # avoid buffering of status message
 
     def run(self):
         self.httpd.serve_forever()