Submitter | Yuya Nishihara |
---|---|
Date | Oct. 29, 2017, 9:05 a.m. |
Message ID | <ce935a5de7737d4706d3.1509267917@mimosa> |
Download | mbox | patch |
Permalink | /patch/25307/ |
State | Accepted |
Headers | show |
Comments
On Sun, 29 Oct 2017 05:05:17 -0400, Yuya Nishihara <yuya@tcha.org> wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1509267232 -32400 > # Sun Oct 29 17:53:52 2017 +0900 > # Branch stable > # Node ID ce935a5de7737d4706d3f5d50184665f955017e3 > # Parent ee3492423f7c8b1a350b2596c247e1b97759d2d7 > test-static-http: flush access log per request > > It appears that stderr is fully buffered on Windows. Ugh, I should have known, since I had to fix this in multiple other places before. Long term, is there any reason that we can't use setvbuf() and _IONBF, since there is no line buffering on Windows? https://msdn.microsoft.com/en-us/library/86cebhfs.aspx This + the removal of the platform path separators fixes the test for me, thanks.
On Sun, 29 Oct 2017 13:57:47 -0400, Matt Harbison wrote: > On Sun, 29 Oct 2017 05:05:17 -0400, Yuya Nishihara <yuya@tcha.org> wrote: > > # HG changeset patch > > # User Yuya Nishihara <yuya@tcha.org> > > # Date 1509267232 -32400 > > # Sun Oct 29 17:53:52 2017 +0900 > > # Branch stable > > # Node ID ce935a5de7737d4706d3f5d50184665f955017e3 > > # Parent ee3492423f7c8b1a350b2596c247e1b97759d2d7 > > test-static-http: flush access log per request > > > > It appears that stderr is fully buffered on Windows. > > Ugh, I should have known, since I had to fix this in multiple other places > before. Long term, is there any reason that we can't use setvbuf() and > _IONBF, since there is no line buffering on Windows? > > https://msdn.microsoft.com/en-us/library/86cebhfs.aspx I doubt setvbuf() would be an easy workaround since stdio layer is likely to have weird behavior. And it's completely written in Python 3 to not use the platform fread/fwrite() API. > This + the removal of the platform path separators fixes the test for me, > thanks. Thanks for testing them.
On Mon, Oct 30, 2017 at 11:18:54PM +0900, Yuya Nishihara wrote: > On Sun, 29 Oct 2017 13:57:47 -0400, Matt Harbison wrote: > > On Sun, 29 Oct 2017 05:05:17 -0400, Yuya Nishihara <yuya@tcha.org> wrote: > > > # HG changeset patch > > > # User Yuya Nishihara <yuya@tcha.org> > > > # Date 1509267232 -32400 > > > # Sun Oct 29 17:53:52 2017 +0900 > > > # Branch stable > > > # Node ID ce935a5de7737d4706d3f5d50184665f955017e3 > > > # Parent ee3492423f7c8b1a350b2596c247e1b97759d2d7 > > > test-static-http: flush access log per request queued, thanks
Patch
diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py --- a/tests/dumbhttp.py +++ b/tests/dumbhttp.py @@ -26,12 +26,16 @@ if os.environ.get('HGIPV6', '0') == '1': else: simplehttpserver = httpserver.httpserver +class _httprequesthandler(httpserver.simplehttprequesthandler): + def log_message(self, format, *args): + httpserver.simplehttprequesthandler.log_message(self, format, *args) + sys.stderr.flush() + class simplehttpservice(object): def __init__(self, host, port): self.address = (host, port) def init(self): - self.httpd = simplehttpserver( - self.address, httpserver.simplehttprequesthandler) + self.httpd = simplehttpserver(self.address, _httprequesthandler) def run(self): self.httpd.serve_forever()