mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
terminal: Support extra arguments in 'shell'. #4504
Tokenize p_sh if used as default in ex_terminal(). Previously p_sh was used as the first arg in a list when calling termopen(), this would try to call an untokenized version of shell, meaning if you had an argument in 'shell': set shell=/bin/bash\ --login the command would fail. Helped-by: oni-link <knil.ino@gmail.com> Closes #3999
This commit is contained in:

committed by
Justin M. Keyes

parent
0c1f783164
commit
2ea7bfc627
@@ -79,6 +79,30 @@ describe(':terminal (with fake shell)', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it("with no argument, and 'shell' is set to empty string", function()
|
||||
nvim('set_option', 'shell', '')
|
||||
terminal_with_fake_shell()
|
||||
wait()
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
E91: 'shell' option is empty |
|
||||
]])
|
||||
end)
|
||||
|
||||
it("with no argument, but 'shell' has arguments, acts like termopen()", function()
|
||||
nvim('set_option', 'shell', nvim_dir..'/shell-test -t jeff')
|
||||
terminal_with_fake_shell()
|
||||
wait()
|
||||
screen:expect([[
|
||||
jeff $ |
|
||||
[Process exited 0] |
|
||||
|
|
||||
-- TERMINAL -- |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('executes a given command through the shell', function()
|
||||
terminal_with_fake_shell('echo hi')
|
||||
wait()
|
||||
@@ -90,6 +114,18 @@ describe(':terminal (with fake shell)', function()
|
||||
]])
|
||||
end)
|
||||
|
||||
it("executes a given command through the shell, when 'shell' has arguments", function()
|
||||
nvim('set_option', 'shell', nvim_dir..'/shell-test -t jeff')
|
||||
terminal_with_fake_shell('echo hi')
|
||||
wait()
|
||||
screen:expect([[
|
||||
jeff $ echo hi |
|
||||
|
|
||||
[Process exited 0] |
|
||||
-- TERMINAL -- |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('allows quotes and slashes', function()
|
||||
terminal_with_fake_shell([[echo 'hello' \ "world"]])
|
||||
wait()
|
||||
|
Reference in New Issue
Block a user