diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2017-09-30 21:31:31 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-03-24 22:05:53 +0100 |
commit | 131aad953c007d382cbff1d2560471b29975da87 (patch) | |
tree | c9c319d332050ed3c67bd3570f5213471a9e3af2 /test/functional/terminal/ex_terminal_spec.lua | |
parent | be67d926c5eec3b90cf906471f4b81ed21223c1f (diff) | |
download | rneovim-131aad953c007d382cbff1d2560471b29975da87.tar.gz rneovim-131aad953c007d382cbff1d2560471b29975da87.tar.bz2 rneovim-131aad953c007d382cbff1d2560471b29975da87.zip |
win: defaults: 'shellcmdflag', 'shellxquote' #7343
closes #7698
Wrapping a command in double-quotes allows cmd.exe to safely dequote the
entire command as if the user entered the entire command in an
interactive prompt. This reduces the need to escape nested and uneven
double quotes.
The `/s` flag of cmd.exe makes the behaviour more reliable:
:set shellcmdflag=/s\ /c
Before this patch, cmd.exe cannot use cygwin echo.exe (as opposed to
cmd.exe `echo` builtin) even if it is wrapped in double quotes.
Example:
:: internal echo
> cmd /s /c " echo foo\:bar" "
foo\:bar"
:: cygwin echo.exe
> cmd /s /c " "echo" foo\:bar" "
foo:bar
Diffstat (limited to 'test/functional/terminal/ex_terminal_spec.lua')
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 0a30b9bb02..4f22f7385d 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -8,6 +8,7 @@ local funcs = helpers.funcs local retry = helpers.retry local ok = helpers.ok local iswin = helpers.iswin +local command = helpers.command describe(':terminal', function() local screen @@ -143,6 +144,7 @@ describe(':terminal (with fake shell)', function() end) it('executes a given command through the shell', function() + command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell('echo hi') screen:expect([[ ^ready $ echo hi | @@ -154,6 +156,7 @@ describe(':terminal (with fake shell)', function() it("executes a given command through the shell, when 'shell' has arguments", function() nvim('set_option', 'shell', nvim_dir..'/shell-test -t jeff') + command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell('echo hi') screen:expect([[ ^jeff $ echo hi | @@ -164,6 +167,7 @@ describe(':terminal (with fake shell)', function() end) it('allows quotes and slashes', function() + command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell([[echo 'hello' \ "world"]]) screen:expect([[ ^ready $ echo 'hello' \ "world" | @@ -217,6 +221,7 @@ describe(':terminal (with fake shell)', function() end) it('works with gf', function() + command('set shellxquote=') -- win: avoid extra quotes terminal_with_fake_shell([[echo "scripts/shadacat.py"]]) screen:expect([[ ^ready $ echo "scripts/shadacat.py" | |