changeset 40997:6a372f943e49

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'")
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 18 Dec 2018 00:54:32 -0500
parents 70a00a8cd66e
children 4277e20cfec4
files contrib/hgclient.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgclient.py	Mon Dec 17 23:08:26 2018 -0500
+++ b/contrib/hgclient.py	Tue Dec 18 00:54:32 2018 -0500
@@ -33,7 +33,12 @@
         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