py3: convert hg executable path to bytes in missing case in procutil
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 29 Aug 2019 23:38:24 -0700
changeset 42838 f1f9ad5ae4f8
parent 42837 cde1c101ab8a
child 42839 ee0f511b7a22
py3: convert hg executable path to bytes in missing case in procutil We (Google) noticed this in our tests when we use chg and a hg wrapper script not called 'hg'. The executable then ended up being a native string, which then failed in chgserver when trying to convert the environment dict to a byte string. Differential Revision: https://phab.mercurial-scm.org/D6775
mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py	Sat Aug 31 10:26:39 2019 -0700
+++ b/mercurial/utils/procutil.py	Thu Aug 29 23:38:24 2019 -0700
@@ -246,7 +246,7 @@
             _sethgexecutable(pycompat.fsencode(mainmod.__file__))
         else:
             exe = findexe('hg') or os.path.basename(sys.argv[0])
-            _sethgexecutable(exe)
+            _sethgexecutable(pycompat.fsencode(exe))
     return _hgexecutable
 
 def _sethgexecutable(path):