0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a space

Problem:    MS-Windows: shell commands fail if &shell contains a space.
Solution:   Use quotes instead of escaping. (closes #4920)
This commit is contained in:
Bram Moolenaar
2019-10-05 12:09:32 +02:00
parent fd00c042af
commit 2efc44b3f0
6 changed files with 122 additions and 5 deletions

View File

@@ -102,7 +102,26 @@ set_init_1(int clean_arg)
|| ((p = (char_u *)default_shell()) != NULL && *p != NUL)
#endif
)
#if defined(MSWIN)
{
// For MS-Windows put the path in quotes instead of escaping spaces.
char_u *cmd;
size_t len;
if (vim_strchr(p, ' ') != NULL)
{
len = STRLEN(p) + 3; // two quotes and a trailing NUL
cmd = alloc(len);
vim_snprintf((char *)cmd, len, "\"%s\"", p);
set_string_default("sh", cmd);
vim_free(cmd);
}
else
set_string_default("sh", p);
}
#else
set_string_default_esc("sh", p, TRUE);
#endif
#ifdef FEAT_WILDIGN
/*