[PATCH 2 of 3] windows: strip double quotes from the command to be found in findexe()

Matt Harbison mharbison72 at gmail.com
Tue Feb 20 23:32:53 EST 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1519181569 18000
#      Tue Feb 20 21:52:49 2018 -0500
# Node ID 8d7c512d216042abc6df7653ad6981275880ec45
# Parent  50a2885e94783ecce0820a08dd40d26cadbf0ae1
windows: strip double quotes from the command to be found in findexe()

After 94a1ff16f362 stopped unconditionally using posix style shlex.split(), the
quotes remained around the editor path in debuginstall, so the string wasn't
found in PATH.  This seems a little more robust than fixing it in the debug
command (and more consistent with how cmd.exe searches).

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -324,6 +324,9 @@
     PATH isn't searched if command is an absolute or relative path.
     An extension from PATHEXT is found and added if not present.
     If command isn't found None is returned.'''
+    if command[0] == '"' and command[-1] == '"':
+        command = command[1:-1]
+
     pathext = encoding.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
     pathexts = [ext for ext in pathext.lower().split(pycompat.ospathsep)]
     if os.path.splitext(command)[1].lower() in pathexts:


More information about the Mercurial-devel mailing list