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

login
register
mail settings
Submitter phabricator
Date Sept. 5, 2019, 6:57 p.m.
Message ID <abd8890f2a54f2679db1b32ffa9c448e@localhost.localdomain>
Download mbox | patch
Permalink /patch/41476/
State Not Applicable
Headers show

Comments

phabricator - Sept. 5, 2019, 6:57 p.m.
Closed by commit rHGdb51a4ac85ac: py3: use pycompat.sysargv[0] for instead of fsencode(sys.argv[0]) (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

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

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




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

Patch

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):