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

Yuya Nishihara yuya at tcha.org
Wed Feb 21 06:31:07 EST 2018


On Tue, 20 Feb 2018 23:32:53 -0500, Matt Harbison wrote:
> # 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]

I think findexe() is designed to take an exact command name, not a command-line
string. It's probably better to handle quotes by caller.


More information about the Mercurial-devel mailing list