changeset 40712:246b61bfdc2f

procutil: don't allow the main 'hg' script to be treated as the Windows exe Previously, there were a handful of errors like this: $ hg prefetch --repack (running background incremental repack) + abort: %1 is not a valid Win32 application + [255] CreateProcess() doesn't append .exe when `lpApplicationName` contains a path, and a python script isn't directly executable.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 23 Nov 2018 22:27:57 -0500
parents 72d88a975655
children cfaf3843491b
files mercurial/utils/procutil.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/procutil.py	Fri Nov 23 22:18:56 2018 -0500
+++ b/mercurial/utils/procutil.py	Fri Nov 23 22:27:57 2018 -0500
@@ -241,7 +241,7 @@
                 _sethgexecutable(encoding.environ['EXECUTABLEPATH'])
             else:
                 _sethgexecutable(pycompat.sysexecutable)
-        elif (os.path.basename(
+        elif (not pycompat.iswindows and os.path.basename(
             pycompat.fsencode(getattr(mainmod, '__file__', ''))) == 'hg'):
             _sethgexecutable(pycompat.fsencode(mainmod.__file__))
         else: