comparison mercurial/utils/procutil.py @ 42838:f1f9ad5ae4f8

py3: convert hg executable path to bytes in missing case in procutil We (Google) noticed this in our tests when we use chg and a hg wrapper script not called 'hg'. The executable then ended up being a native string, which then failed in chgserver when trying to convert the environment dict to a byte string. Differential Revision: https://phab.mercurial-scm.org/D6775
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 29 Aug 2019 23:38:24 -0700
parents ca1014ad3de4
children db51a4ac85ac
comparison
equal deleted inserted replaced
42837:cde1c101ab8a 42838:f1f9ad5ae4f8
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') or os.path.basename(sys.argv[0])
249 _sethgexecutable(exe) 249 _sethgexecutable(pycompat.fsencode(exe))
250 return _hgexecutable 250 return _hgexecutable
251 251
252 def _sethgexecutable(path): 252 def _sethgexecutable(path):
253 """set location of the 'hg' executable""" 253 """set location of the 'hg' executable"""
254 global _hgexecutable 254 global _hgexecutable