comparison tests/dumbhttp.py @ 37672:8bacc09814ba

py3: make values bytes before passing into server.runservice() The values of opts dict still needed to be converted to bytes. Differential Revision: https://phab.mercurial-scm.org/D3330
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 14 Apr 2018 02:07:42 +0530
parents bf2db35a6fe7
children e46c3b6a47b5
comparison
equal deleted inserted replaced
37671:726a95a57eeb 37672:8bacc09814ba
11 import signal 11 import signal
12 import socket 12 import socket
13 import sys 13 import sys
14 14
15 from mercurial import ( 15 from mercurial import (
16 pycompat,
16 server, 17 server,
17 util, 18 util,
18 ) 19 )
19 20
20 httpserver = util.httpserver 21 httpserver = util.httpserver
61 parser.error("options --logfile and --foreground are mutually " 62 parser.error("options --logfile and --foreground are mutually "
62 "exclusive") 63 "exclusive")
63 if options.foreground and options.pid: 64 if options.foreground and options.pid:
64 parser.error("options --pid and --foreground are mutually exclusive") 65 parser.error("options --pid and --foreground are mutually exclusive")
65 66
66 opts = {'pid_file': options.pid, 67 opts = {b'pid_file': options.pid,
67 'daemon': not options.foreground, 68 b'daemon': not options.foreground,
68 'daemon_postexec': options.daemon_postexec} 69 b'daemon_postexec': options.daemon_postexec}
69 service = simplehttpservice(options.host, options.port) 70 service = simplehttpservice(options.host, options.port)
71 runargs = [sys.executable, __file__] + sys.argv[1:]
72 runargs = [pycompat.fsencode(a) for a in runargs]
70 server.runservice(opts, initfn=service.init, runfn=service.run, 73 server.runservice(opts, initfn=service.init, runfn=service.run,
71 logfile=options.logfile, 74 logfile=options.logfile,
72 runargs=[sys.executable, __file__] + sys.argv[1:]) 75 runargs=runargs)