diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-12 01:35:17 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-12 02:28:43 +0200 |
| commit | 7c4e5dfd2722b8c25641cbbc66c5b0133d0e2f03 (patch) | |
| tree | 853aea222ea79998c63a0ef2e17e3e44101166e6 /src/nvim/event/libuv_process.c | |
| parent | d31d177a0c2c9997c2cdb04975bc3354b9a23fb8 (diff) | |
| download | rneovim-7c4e5dfd2722b8c25641cbbc66c5b0133d0e2f03.tar.gz rneovim-7c4e5dfd2722b8c25641cbbc66c5b0133d0e2f03.tar.bz2 rneovim-7c4e5dfd2722b8c25641cbbc66c5b0133d0e2f03.zip | |
win: os_shell_is_cmdexe() + tests
Diffstat (limited to 'src/nvim/event/libuv_process.c')
| -rw-r--r-- | src/nvim/event/libuv_process.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index ab69bea04c..f5a41d151b 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -8,7 +8,6 @@ #include "nvim/event/process.h" #include "nvim/event/libuv_process.h" #include "nvim/log.h" -#include "nvim/path.h" #include "nvim/os/os.h" #ifdef INCLUDE_GENERATED_DECLARATIONS @@ -27,22 +26,9 @@ int libuv_process_spawn(LibuvProcess *uvproc) uvproc->uvopts.flags |= UV_PROCESS_DETACHED; } #ifdef WIN32 - // libuv assumes spawned processes follow the convention from - // CommandLineToArgvW(), cmd.exe does not. Disable quoting since it will - // result in unexpected behaviour, the caller is left with the responsibility - // to quote arguments accordingly. system('') has shell* options for this. - // - // Disable quoting for cmd, cmd.exe and $COMSPEC with a cmd.exe filename - bool is_cmd = STRICMP(proc->argv[0], "cmd.exe") == 0 - || STRICMP(proc->argv[0], "cmd") == 0; - if (!is_cmd) { - const char_u *comspec = (char_u *)os_getenv("COMSPEC"); - const char_u *comspecshell = path_tail((char_u *)proc->argv[0]); - is_cmd = comspec != NULL && STRICMP(proc->argv[0], comspec) == 0 - && STRICMP("cmd.exe", (char *)comspecshell) == 0; - } - - if (is_cmd) { + // libuv collapses the argv to a CommandLineToArgvW()-style string. cmd.exe + // expects a different syntax (must be prepared by the caller before now). + if (os_shell_is_cmdexe(proc->argv[0])) { uvproc->uvopts.flags |= UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS; } #endif |