[PATCH 3 of 3] py3: resolve Unicode issues around `hg serve` on Windows
Matt Harbison
mharbison72 at gmail.com
Thu Sep 20 12:10:01 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1537415656 14400
# Wed Sep 19 23:54:16 2018 -0400
# Node ID b5969b11d817a810d608d944e00e6afe64286c73
# Parent de033c83ce6ef41b81cef5c27d33b4d518005085
py3: resolve Unicode issues around `hg serve` on Windows
Presumably we're going to want to use CreateProcessW(), and possibly get rid of
pycompat.getcwd() here (which maps to the DeprecationWarning causing
os.getcwdb()) to use os.getcwd() directly. But this was a minimal change to
get rid of some stacktraces in test-run-tests.t.
diff --git a/mercurial/win32.py b/mercurial/win32.py
--- a/mercurial/win32.py
+++ b/mercurial/win32.py
@@ -579,10 +579,11 @@ def spawndetached(args):
env = '\0'
env += '\0'
- args = subprocess.list2cmdline(args)
+ args = subprocess.list2cmdline(pycompat.rapply(encoding.strfromlocal, args))
+ # TODO: CreateProcessW on py3?
res = _kernel32.CreateProcessA(
- None, args, None, None, False, _CREATE_NO_WINDOW,
+ None, encoding.strtolocal(args), None, None, False, _CREATE_NO_WINDOW,
env, pycompat.getcwd(), ctypes.byref(si), ctypes.byref(pi))
if not res:
raise ctypes.WinError()
diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -523,7 +523,7 @@ def rename(src, dst):
os.rename(src, dst)
def gethgcmd():
- return [sys.executable] + sys.argv[:1]
+ return [encoding.strtolocal(arg) for arg in [sys.executable] + sys.argv[:1]]
def groupmembers(name):
# Don't support groups on Windows for now
More information about the Mercurial-devel
mailing list