Patchwork [5,of,5] hgweb: make log streams compatible with command server

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 2, 2016, 12:02 p.m.
Message ID <827132690102f124cf5e.1478088137@mimosa>
Download mbox | patch
Permalink /patch/17276/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 2, 2016, 12:02 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1403928812 -32400
#      Sat Jun 28 13:13:32 2014 +0900
# Node ID 827132690102f124cf5ee9d1888fdddba1987b9d
# Parent  e1a050ebbf75c6f512fe041864a1e53b647c3967
# EXP-Topic stdio
hgweb: make log streams compatible with command server

Even though it would be useless to start a web server by a command server,
it should be doable in principle. Also, we can't use sys.stdout/err directly
on Python 3 because they are unicode streams.
Pierre-Yves David - Nov. 2, 2016, 2:10 p.m.
On 11/02/2016 01:02 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1403928812 -32400
> #      Sat Jun 28 13:13:32 2014 +0900
> # Node ID 827132690102f124cf5ee9d1888fdddba1987b9d
> # Parent  e1a050ebbf75c6f512fe041864a1e53b647c3967
> # EXP-Topic stdio
> hgweb: make log streams compatible with command server
>
> Even though it would be useless to start a web server by a command server,
> it should be doable in principle. Also, we can't use sys.stdout/err directly
> on Python 3 because they are unicode streams.

This series is pushed, thanks.

Patch

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -281,8 +281,8 @@  class MercurialHTTPServer(_mixin, httpse
             prefix = '/' + prefix.strip('/')
         self.prefix = prefix
 
-        alog = openlog(ui.config('web', 'accesslog', '-'), sys.stdout)
-        elog = openlog(ui.config('web', 'errorlog', '-'), sys.stderr)
+        alog = openlog(ui.config('web', 'accesslog', '-'), ui.fout)
+        elog = openlog(ui.config('web', 'errorlog', '-'), ui.ferr)
         self.accesslog = alog
         self.errorlog = elog