# HG changeset patch # User Matt Harbison # Date 2018-12-18 05:54:32 # Node ID 6a372f943e490dd14a8ec4e2b4e8b1716104ac6a # Parent 70a00a8cd66ec246624ca995b203d49d8ce5e4c6 py3: convert popen() command arguments in hgclient to str on Windows This fixes test-commandserver.t and test-keyword.t, which was previously complaining TypeError("a bytes-like object is required, not 'str'") diff --git a/contrib/hgclient.py b/contrib/hgclient.py --- a/contrib/hgclient.py +++ b/contrib/hgclient.py @@ -33,7 +33,12 @@ def connectpipe(path=None, extraargs=()) cmdline += [b'-R', path] cmdline.extend(extraargs) - server = subprocess.Popen(cmdline, stdin=subprocess.PIPE, + def tonative(cmdline): + if os.name != r'nt': + return cmdline + return [arg.decode("utf-8") for arg in cmdline] + + server = subprocess.Popen(tonative(cmdline), stdin=subprocess.PIPE, stdout=subprocess.PIPE) return server