From 52268afb1cc47ca5ac91ca265e95827bff2901bd Mon Sep 17 00:00:00 2001 From: Anton Kriese Date: Thu, 24 Nov 2022 13:13:36 +0100 Subject: [PATCH 1/5] fix(exepath)!: prefers extensionless for powershell PROBLEM: exepath("test") should prefer ".bat" when shell=powershell. Current behavior differs from Vim 8.2.3071. TEST CASE: 1. in a folder which is in $PATH, create files "test" "test.bat". - "(Get-Command test).Path test" returns "test.bat". 2. compare nvim: nvim --clean :set shell=powershell :echo exepath("test") 3. should returns "path\to\test.bat" (before this patch it returns "path\to\test"). SOLUTION: After this patch, the binary files "text.exe", "test.bat", "test.com" will be found, but the file "test" (without any extension) will not be found (matches Vim 8.2.3071). But powershell's `where` and `Get-Command` _do_ find the extensionless 'test' file. But Nvim with ":set shell=cmd.exe", doesn't find "test" either (before and after this patch), even though `where test` returns correct path in cmd. - `where` is a program to find files in general, not just executable files. -`Get-Command` returning extensionless (and thus non-executable) file is puzzling even to Chris Dent, [PowerShell expert][1] (asked on Discord). [1]: https://www.amazon.com/Mastering-PowerShell-Scripting-Automate-environment-ebook/dp/B0971MG88X Co-authored-by: Enan Ajmain <3nan.ajmain@gmail.com> Helped-by: erw7 Fixes #21045 --- src/nvim/os/fs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index e0449d468a..98ec9aa826 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -302,7 +302,9 @@ static bool is_executable(const char *name, char **abspath) static bool is_executable_ext(const char *name, char **abspath) FUNC_ATTR_NONNULL_ARG(1) { - const bool is_unix_shell = strstr((char *)path_tail(p_sh), "sh") != NULL; + const bool is_unix_shell = strstr(path_tail(p_sh), "powershell") == NULL + && strstr(path_tail(p_sh), "pwsh") == NULL + && strstr(path_tail(p_sh), "sh") != NULL; char *nameext = strrchr(name, '.'); size_t nameext_len = nameext ? strlen(nameext) : 0; xstrlcpy(os_buf, name, sizeof(os_buf)); From 48144525bfb66b7a99668bd8c25b79d43c7798ff Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Jan 2023 09:15:26 +0100 Subject: [PATCH 2/5] vim-patch:8.2.3061: testing the shell option is incomplete and spread out Problem: Testing the shell option is incomplete and spread out. Solution: Move shell tests to one file and increase coverage. (Yegappan Lakshmanan, closes vim/vim#8464) https://github.com/vim/vim/commit/054794c20f6322bbd9482c4124041dc0a140c78e Co-authored-by: Yegappan Lakshmanan --- src/nvim/testdir/test_shell.vim | 160 +++++++++++++++++++++++++++++++ src/nvim/testdir/test_system.vim | 36 ------- 2 files changed, 160 insertions(+), 36 deletions(-) create mode 100644 src/nvim/testdir/test_shell.vim diff --git a/src/nvim/testdir/test_shell.vim b/src/nvim/testdir/test_shell.vim new file mode 100644 index 0000000000..8612310183 --- /dev/null +++ b/src/nvim/testdir/test_shell.vim @@ -0,0 +1,160 @@ +" Test for the shell related options ('shell', 'shellcmdflag', 'shellpipe', +" 'shellquote', 'shellredir', 'shellxescape', and 'shellxquote') + +source check.vim +source shared.vim + +func Test_shell_options() + " For each shell, the following options are checked: + " 'shellcmdflag', 'shellpipe', 'shellquote', 'shellredir', 'shellxescape', + " 'shellxquote' + let shells = [] + if has('unix') + let shells += [['sh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['ksh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['mksh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['zsh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['zsh-beta', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['bash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['fish', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['ash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['dash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], + \ ['csh', '-c', '|& tee', '', '>&', '', ''], + \ ['tcsh', '-c', '|& tee', '', '>&', '', '']] + endif + if has('win32') + let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''], + \ ['cmd.exe', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '('], + \ ['powershell.exe', '-c', '>', '', '>', '"&|<>()@^', '"'], + \ ['powershell', '-c', '>', '', '>', '"&|<>()@^', '"'], + \ ['sh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['ksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['mksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['pdksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['zsh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['zsh-beta.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['bash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['dash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], + \ ['csh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"'], + \ ['tcsh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"']] + endif + + let after =<< trim END + let l = [&shell, &shellcmdflag, &shellpipe, &shellquote] + let l += [&shellredir, &shellxescape, &shellxquote] + call writefile([json_encode(l)], 'Xtestout') + qall! + END + for e in shells + if RunVim([], after, '--cmd "set shell=' .. e[0] .. '"') + call assert_equal(e, json_decode(readfile('Xtestout')[0])) + endif + endfor + + for e in shells + exe 'set shell=' .. e[0] + if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$' + let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%#'" + let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\#'" + else + let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%#'" + let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\#'" + endif + call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%#"), e[0]) + call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%#", 1), e[0]) + endfor + set shell& + call delete('Xtestout') +endfunc + +" Test for the 'shell' option +func Test_shell() + throw 'Skipped: Nvim missing :shell currently' + CheckUnix + let save_shell = &shell + set shell= + let caught_e91 = 0 + try + shell + catch /E91:/ + let caught_e91 = 1 + endtry + call assert_equal(1, caught_e91) + let &shell = save_shell +endfunc + +" Test for the 'shellquote' option +func Test_shellquote() + CheckUnix + set shellquote=# + set verbose=20 + redir => v + silent! !echo Hello + redir END + set verbose& + set shellquote& + call assert_match(': "#echo Hello#"', v) +endfunc + +func Test_shellescape() + let save_shell = &shell + set shell=bash + call assert_equal("'text'", shellescape('text')) + call assert_equal("'te\"xt'", 'te"xt'->shellescape()) + call assert_equal("'te'\\''xt'", shellescape("te'xt")) + + call assert_equal("'te%xt'", shellescape("te%xt")) + call assert_equal("'te\\%xt'", shellescape("te%xt", 1)) + call assert_equal("'te#xt'", shellescape("te#xt")) + call assert_equal("'te\\#xt'", shellescape("te#xt", 1)) + call assert_equal("'te!xt'", shellescape("te!xt")) + call assert_equal("'te\\!xt'", shellescape("te!xt", 1)) + + call assert_equal("'te\nxt'", shellescape("te\nxt")) + call assert_equal("'te\\\nxt'", shellescape("te\nxt", 1)) + set shell=tcsh + call assert_equal("'te\\!xt'", shellescape("te!xt")) + call assert_equal("'te\\\\!xt'", shellescape("te!xt", 1)) + call assert_equal("'te\\\nxt'", shellescape("te\nxt")) + call assert_equal("'te\\\\\nxt'", shellescape("te\nxt", 1)) + + let &shell = save_shell +endfunc + +" Test for 'shellxquote' +func Test_shellxquote() + CheckUnix + + let save_shell = &shell + let save_sxq = &shellxquote + let save_sxe = &shellxescape + + call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell') + call setfperm('Xtestshell', "r-x------") + set shell=./Xtestshell + + set shellxquote=\\" + call feedkeys(":!pwd\\", 'xt') + call assert_equal(['Cmd: [-c "pwd"]'], readfile('Xlog')) + + set shellxquote=( + call feedkeys(":!pwd\\", 'xt') + call assert_equal(['Cmd: [-c (pwd)]'], readfile('Xlog')) + + set shellxquote=\\"( + call feedkeys(":!pwd\\", 'xt') + call assert_equal(['Cmd: [-c "(pwd)"]'], readfile('Xlog')) + + set shellxescape=\"&<<()@^ + set shellxquote=( + call feedkeys(":!pwd\"&<<{}@^\\", 'xt') + call assert_equal(['Cmd: [-c (pwd^"^&^<^<{}^@^^)]'], readfile('Xlog')) + + let &shell = save_shell + let &shellxquote = save_sxq + let &shellxescape = save_sxe + call delete('Xtestshell') + call delete('Xlog') +endfunc + +" vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_system.vim b/src/nvim/testdir/test_system.vim index bfa8a277bd..6c8373b335 100644 --- a/src/nvim/testdir/test_system.vim +++ b/src/nvim/testdir/test_system.vim @@ -142,40 +142,4 @@ func Test_system_with_shell_quote() endtry endfunc -" Test for 'shellxquote' -func Test_Shellxquote() - CheckUnix - - let save_shell = &shell - let save_sxq = &shellxquote - let save_sxe = &shellxescape - - call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell') - call setfperm('Xtestshell', "r-x------") - set shell=./Xtestshell - - set shellxquote=\\" - call feedkeys(":!pwd\\", 'xt') - call assert_equal(['Cmd: [-c "pwd"]'], readfile('Xlog')) - - set shellxquote=( - call feedkeys(":!pwd\\", 'xt') - call assert_equal(['Cmd: [-c (pwd)]'], readfile('Xlog')) - - set shellxquote=\\"( - call feedkeys(":!pwd\\", 'xt') - call assert_equal(['Cmd: [-c "(pwd)"]'], readfile('Xlog')) - - set shellxescape=\"&<<()@^ - set shellxquote=( - call feedkeys(":!pwd\"&<<{}@^\\", 'xt') - call assert_equal(['Cmd: [-c (pwd^"^&^<^<{}^@^^)]'], readfile('Xlog')) - - let &shell = save_shell - let &shellxquote = save_sxq - let &shellxescape = save_sxe - call delete('Xtestshell') - call delete('Xlog') -endfunc - " vim: shiftwidth=2 sts=2 expandtab From 26d6e27973d693d5b31d2420bccac2f12343463c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Jan 2023 09:19:22 +0100 Subject: [PATCH 3/5] vim-patch:8.2.3070: not enough testing for shell use Problem: Not enough testing for shell use. Solution: Add a bit more testing. (Yegappan Lakshmanan, closes vim/vim#8469) https://github.com/vim/vim/commit/ffec6dd16a766180429addaa78928c773a3c9832 Co-authored-by: Yegappan Lakshmanan --- src/nvim/testdir/test_shell.vim | 45 ++++++++++++++++++++++++++++--- src/nvim/testdir/test_startup.vim | 21 --------------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/nvim/testdir/test_shell.vim b/src/nvim/testdir/test_shell.vim index 8612310183..e6958a3910 100644 --- a/src/nvim/testdir/test_shell.vim +++ b/src/nvim/testdir/test_shell.vim @@ -5,9 +5,8 @@ source check.vim source shared.vim func Test_shell_options() - " For each shell, the following options are checked: - " 'shellcmdflag', 'shellpipe', 'shellquote', 'shellredir', 'shellxescape', - " 'shellxquote' + " The expected value of 'shellcmdflag', 'shellpipe', 'shellquote', + " 'shellredir', 'shellxescape', 'shellxquote' for the supported shells. let shells = [] if has('unix') let shells += [['sh', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''], @@ -39,6 +38,8 @@ func Test_shell_options() \ ['tcsh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"']] endif + " start a new Vim instance with 'shell' set to each of the supported shells + " and check the default shell option settings let after =<< trim END let l = [&shell, &shellcmdflag, &shellpipe, &shellquote] let l += [&shellredir, &shellxescape, &shellxquote] @@ -51,6 +52,7 @@ func Test_shell_options() endif endfor + " Test shellescape() for each of the shells. for e in shells exe 'set shell=' .. e[0] if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$' @@ -62,8 +64,20 @@ func Test_shell_options() endif call assert_equal(str1, shellescape("cmd \"arg1\" 'arg2' !%#"), e[0]) call assert_equal(str2, shellescape("cmd \"arg1\" 'arg2' !%#", 1), e[0]) + + " Try running an external command with the shell. + if executable(e[0]) + " set the shell options for the current 'shell' + let [&shellcmdflag, &shellpipe, &shellquote, &shellredir, + \ &shellxescape, &shellxquote] = e[1:6] + new + r !echo hello + call assert_equal('hello', substitute(getline(2), '\W', '', 'g'), e[0]) + bwipe! + endif endfor - set shell& + set shell& shellcmdflag& shellpipe& shellquote& + set shellredir& shellxescape& shellxquote& call delete('Xtestout') endfunc @@ -96,6 +110,7 @@ func Test_shellquote() call assert_match(': "#echo Hello#"', v) endfunc +" Test for the 'shellescape' option func Test_shellescape() let save_shell = &shell set shell=bash @@ -157,4 +172,26 @@ func Test_shellxquote() call delete('Xlog') endfunc +" Test for using the shell set in the $SHELL environment variable +func Test_set_shell() + let after =<< trim [CODE] + call writefile([&shell], "Xtestout") + quit! + [CODE] + + if has('win32') + let $SHELL = 'C:\with space\cmd.exe' + let expected = '"C:\with space\cmd.exe"' + else + let $SHELL = '/bin/with space/sh' + let expected = '"/bin/with space/sh"' + endif + + if RunVimPiped([], after, '', '') + let lines = readfile('Xtestout') + call assert_equal(expected, lines[0]) + endif + call delete('Xtestout') +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 54b7636f69..b294d62ab4 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -725,27 +725,6 @@ func Test_read_stdin() call delete('Xtestout') endfunc -func Test_set_shell() - let after =<< trim [CODE] - call writefile([&shell], "Xtestout") - quit! - [CODE] - - if has('win32') - let $SHELL = 'C:\with space\cmd.exe' - let expected = '"C:\with space\cmd.exe"' - else - let $SHELL = '/bin/with space/sh' - let expected = '"/bin/with space/sh"' - endif - - if RunVimPiped([], after, '', '') - let lines = readfile('Xtestout') - call assert_equal(expected, lines[0]) - endif - call delete('Xtestout') -endfunc - func Test_progpath() " Tests normally run with "./vim" or "../vim", these must have been expanded " to a full path. From 7360dda670d3702a2f6a8d4b65180a243811695b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Jan 2023 09:28:40 +0100 Subject: [PATCH 4/5] vim-patch:8.2.3071: shell options are not set properly for PowerShell (Most of this patch is intentionally dropped, it adds far too much special-cases for almost zero purpose: ":help shell-powershell" makes it easy to choose powershell without spreading special-cases throughout the codebase, randomly changing slash behavior, etc.) Problem: Shell options are not set properly for PowerShell. Solution: Use better option defaults. (Mike Willams, closes vim/vim#8459) https://github.com/vim/vim/commit/127950241e84c822d3c50f46a00d42a70d2d5cb6 Co-authored-by: Mike Williams --- src/nvim/testdir/test_shell.vim | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_shell.vim b/src/nvim/testdir/test_shell.vim index e6958a3910..2166308aea 100644 --- a/src/nvim/testdir/test_shell.vim +++ b/src/nvim/testdir/test_shell.vim @@ -24,8 +24,10 @@ func Test_shell_options() if has('win32') let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''], \ ['cmd.exe', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '('], - \ ['powershell.exe', '-c', '>', '', '>', '"&|<>()@^', '"'], - \ ['powershell', '-c', '>', '', '>', '"&|<>()@^', '"'], + \ ['powershell.exe', '-Command', '2>&1 | Out-File -Encoding default', + \ '', '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'], + \ ['powershell', '-Command', '2>&1 | Out-File -Encoding default', '', + \ '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'], \ ['sh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], \ ['ksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], \ ['mksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], @@ -58,6 +60,9 @@ func Test_shell_options() if e[0] =~# '.*csh$' || e[0] =~# '.*csh.exe$' let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%#'" let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\#'" + elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$' + let str1 = "'cmd \"arg1\" ''arg2'' !%#'" + let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\#'" else let str1 = "'cmd \"arg1\" '\\''arg2'\\'' !%#'" let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\!\\%\\#'" @@ -136,6 +141,28 @@ func Test_shellescape() let &shell = save_shell endfunc +" Test for 'shellslash' +func Test_shellslash() + CheckOption shellslash + let save_shellslash = &shellslash + " The shell and cmdflag, and expected slash in tempname with shellslash set or + " unset. The assert checks the file separator before the leafname. + " ".*\\\\[^\\\\]*$" + let shells = [['cmd', '/c', '\\', '/'], + \ ['powershell', '-Command', '\\', '/'], + \ ['sh', '-c', '/', '/']] + for e in shells + exe 'set shell=' .. e[0] .. ' | set shellcmdflag=' .. e[1] + set noshellslash + let file = tempname() + call assert_match('^.\+' .. e[2] .. '[^' .. e[2] .. ']\+$', file, e[0] .. ' ' .. e[1] .. ' nossl') + set shellslash + let file = tempname() + call assert_match('^.\+' .. e[3] .. '[^' .. e[3] .. ']\+$', file, e[0] .. ' ' .. e[1] .. ' ssl') + endfor + let &shellslash = save_shellslash +endfunc + " Test for 'shellxquote' func Test_shellxquote() CheckUnix From e5b9485eac1f6d5432d55c04d1b70c0740e22f92 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 16 Jan 2023 10:20:35 +0100 Subject: [PATCH 5/5] test: align Test_shell_options, Test_shellslash with Nvim default 'shellxquote' Nvim default was adjusted in: 131aad953c007d382cbff1d2560471b29975da87 The use of "/s" is different than Vim, and may avoid the need for `shellxquote="&|<>()@^`. For the other shells, Nvim intentionally does not fiddle with the various "shell*" options if 'shell' is set by the user: if the user sets 'shell', they are expected to set other "shell*" options correctly. --- src/nvim/testdir/test_shell.vim | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/nvim/testdir/test_shell.vim b/src/nvim/testdir/test_shell.vim index 2166308aea..8b9c7a5b12 100644 --- a/src/nvim/testdir/test_shell.vim +++ b/src/nvim/testdir/test_shell.vim @@ -22,22 +22,7 @@ func Test_shell_options() \ ['tcsh', '-c', '|& tee', '', '>&', '', '']] endif if has('win32') - let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''], - \ ['cmd.exe', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '('], - \ ['powershell.exe', '-Command', '2>&1 | Out-File -Encoding default', - \ '', '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'], - \ ['powershell', '-Command', '2>&1 | Out-File -Encoding default', '', - \ '2>&1 | Out-File -Encoding default', '"&|<>()@^', '"'], - \ ['sh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['ksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['mksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['pdksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['zsh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['zsh-beta.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['bash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['dash.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'], - \ ['csh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"'], - \ ['tcsh.exe', '-c', '>&', '', '>&', '"&|<>()@^', '"']] + let shells += [['cmd', '/s /c', '>%s 2>&1', '', '>%s 2>&1', '', '"']] endif " start a new Vim instance with 'shell' set to each of the supported shells @@ -148,8 +133,8 @@ func Test_shellslash() " The shell and cmdflag, and expected slash in tempname with shellslash set or " unset. The assert checks the file separator before the leafname. " ".*\\\\[^\\\\]*$" - let shells = [['cmd', '/c', '\\', '/'], - \ ['powershell', '-Command', '\\', '/'], + let shells = [['cmd', '/c', '/', '/'], + \ ['powershell', '-Command', '/', '/'], \ ['sh', '-c', '/', '/']] for e in shells exe 'set shell=' .. e[0] .. ' | set shellcmdflag=' .. e[1]