diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-05 12:09:32 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-05 12:09:32 +0200 |
commit | 2efc44b3f0b6bd8307cb281af095e08e15ab1c24 (patch) | |
tree | 4245a8fef089e696e8eb6df87e02cafbc4d7806e /src/option.c | |
parent | fd00c042afc40539447e798aadbd0a2219fdbdc1 (diff) | |
download | vim-git-2efc44b3f0b6bd8307cb281af095e08e15ab1c24.tar.gz |
patch 8.1.2115: MS-Windows: shell commands fail if &shell contains a spacev8.1.2115
Problem: MS-Windows: shell commands fail if &shell contains a space.
Solution: Use quotes instead of escaping. (closes #4920)
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/option.c b/src/option.c index 3d408143e..75ff3cdb2 100644 --- a/src/option.c +++ b/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 /* |