comparison mercurial/utils/procutil.py @ 42854:db51a4ac85ac

py3: use pycompat.sysargv[0] for instead of fsencode(sys.argv[0]) Yuya noted in a recent review that fsencode(sys.argv[0]) could be incorrect on Windows. Differential Revision: https://phab.mercurial-scm.org/D6782
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 01 Sep 2019 23:43:59 -0700
parents f1f9ad5ae4f8
children acf80f9edc85
comparison
equal deleted inserted replaced
42853:37debb6771f5 42854:db51a4ac85ac
243 _sethgexecutable(pycompat.sysexecutable) 243 _sethgexecutable(pycompat.sysexecutable)
244 elif (not pycompat.iswindows and os.path.basename( 244 elif (not pycompat.iswindows and os.path.basename(
245 pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'): 245 pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'):
246 _sethgexecutable(pycompat.fsencode(mainmod.__file__)) 246 _sethgexecutable(pycompat.fsencode(mainmod.__file__))
247 else: 247 else:
248 exe = findexe('hg') or os.path.basename(sys.argv[0]) 248 exe = findexe('hg')
249 _sethgexecutable(pycompat.fsencode(exe)) 249 if exe:
250 _sethgexecutable(pycompat.fsencode(exe))
251 else:
252 _sethgexecutable(os.path.basename(pycompat.sysargv[0]))
250 return _hgexecutable 253 return _hgexecutable
251 254
252 def _sethgexecutable(path): 255 def _sethgexecutable(path):
253 """set location of the 'hg' executable""" 256 """set location of the 'hg' executable"""
254 global _hgexecutable 257 global _hgexecutable