py3: make values bytes before passing into server.runservice()
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 14 Apr 2018 02:07:42 +0530
changeset 37672 8bacc09814ba
parent 37671 726a95a57eeb
child 37673 0c6b1ec75b73
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
tests/dumbhttp.py
--- a/tests/dumbhttp.py	Fri Apr 13 18:44:18 2018 -0400
+++ b/tests/dumbhttp.py	Sat Apr 14 02:07:42 2018 +0530
@@ -13,6 +13,7 @@
 import sys
 
 from mercurial import (
+    pycompat,
     server,
     util,
 )
@@ -63,10 +64,12 @@
     if options.foreground and options.pid:
         parser.error("options --pid and --foreground are mutually exclusive")
 
-    opts = {'pid_file': options.pid,
-            'daemon': not options.foreground,
-            'daemon_postexec': options.daemon_postexec}
+    opts = {b'pid_file': options.pid,
+            b'daemon': not options.foreground,
+            b'daemon_postexec': options.daemon_postexec}
     service = simplehttpservice(options.host, options.port)
+    runargs = [sys.executable, __file__] + sys.argv[1:]
+    runargs = [pycompat.fsencode(a) for a in runargs]
     server.runservice(opts, initfn=service.init, runfn=service.run,
                       logfile=options.logfile,
-                      runargs=[sys.executable, __file__] + sys.argv[1:])
+                      runargs=runargs)