mercurial/utils/procutil.py
changeset 42854 db51a4ac85ac
parent 42838 f1f9ad5ae4f8
child 42883 acf80f9edc85
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