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:
19
src/option.c
19
src/option.c
@@ -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
|
||||
/*
|
||||
|
Reference in New Issue
Block a user