py3: drop incorrect fsencode(findexe(...)) in procutil
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 05 Sep 2019 16:32:33 -0700
changeset 42883 acf80f9edc85
parent 42882 3bed541aa65d
child 42884 775224e26d74
py3: drop incorrect fsencode(findexe(...)) in procutil I recently added the bad call, thinking that findexe() was a standard library function returning a string result, but it's actually our own function returning bytes. Thanks to Yuya for noticing. Differential Revision: https://phab.mercurial-scm.org/D6826
mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py	Sat Sep 07 10:08:47 2019 -0700
+++ b/mercurial/utils/procutil.py	Thu Sep 05 16:32:33 2019 -0700
@@ -245,11 +245,8 @@
             pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'):
             _sethgexecutable(pycompat.fsencode(mainmod.__file__))
         else:
-            exe = findexe('hg')
-            if exe:
-                _sethgexecutable(pycompat.fsencode(exe))
-            else:
-                _sethgexecutable(os.path.basename(pycompat.sysargv[0]))
+            _sethgexecutable(findexe('hg') or
+                             os.path.basename(pycompat.sysargv[0]))
     return _hgexecutable
 
 def _sethgexecutable(path):