D6826: py3: drop incorrect fsencode(findexe(...)) in procutil

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Sep 7 17:05:09 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6826

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -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):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list