D6782: py3: use pycompat.sysargv[0] for instead of fsencode(sys.argv[0])

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Sep 2 02:52:00 EDT 2019


martinvonz updated this revision to Diff 16363.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6782?vs=16362&id=16363

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6782/new/

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

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,8 +245,11 @@
             pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'):
             _sethgexecutable(pycompat.fsencode(mainmod.__file__))
         else:
-            exe = findexe('hg') or os.path.basename(sys.argv[0])
-            _sethgexecutable(pycompat.fsencode(exe))
+            exe = findexe('hg')
+            if exe:
+                _sethgexecutable(pycompat.fsencode(exe))
+            else:
+                _sethgexecutable(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