mirror of
https://github.com/vim/vim.git
synced 2025-12-10 18:46:57 -05:00
patch 9.1.1948: Windows: Vim adds current directory to search path
Problem: Windows: Vim always adds the current directory to search path.
This should only happen when using cmd.exe as 'shell'. For
example, powershell won't run binaries from the current
directory.
Solution: Only add current directory to system path, when using cmd.exe
as 'shell'.
related: #10341
related: 083ec6d9a3
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@ -2716,10 +2716,12 @@ executable({expr}) *executable()*
|
|||||||
executable is always found. Since this directory is added to
|
executable is always found. Since this directory is added to
|
||||||
$PATH it should also work to execute it |win32-PATH|.
|
$PATH it should also work to execute it |win32-PATH|.
|
||||||
*NoDefaultCurrentDirectoryInExePath*
|
*NoDefaultCurrentDirectoryInExePath*
|
||||||
On MS-Windows an executable in Vim's current working directory
|
On MS-Windows when using cmd.exe as 'shell' an executable in
|
||||||
is also normally found, but this can be disabled by setting
|
Vim's current working directory is also normally found, which
|
||||||
the `$NoDefaultCurrentDirectoryInExePath` environment variable.
|
can be disabled by setting the
|
||||||
This is always done for |:!| commands, for security reasons.
|
`$NoDefaultCurrentDirectoryInExePath` environment variable.
|
||||||
|
This is always done when executing external commands using
|
||||||
|
e.g. |:!|, |:make|, |system()| for security reasons.
|
||||||
|
|
||||||
The result is a Number:
|
The result is a Number:
|
||||||
1 exists
|
1 exists
|
||||||
|
|||||||
@ -2867,7 +2867,8 @@ executable_exists(
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mch_getenv("NoDefaultCurrentDirectoryInExePath") == NULL)
|
if (mch_getenv("NoDefaultCurrentDirectoryInExePath") == NULL &&
|
||||||
|
strstr((char *)gettail(p_sh), "cmd.exe") != NULL)
|
||||||
{
|
{
|
||||||
STRCPY(pathbuf.string, ".;");
|
STRCPY(pathbuf.string, ".;");
|
||||||
pathbuf.length = 2;
|
pathbuf.length = 2;
|
||||||
|
|||||||
@ -729,6 +729,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1948,
|
||||||
/**/
|
/**/
|
||||||
1947,
|
1947,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user