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:
Jack Bracewell
2016-03-29 13:47:30 +01:00
committed by Justin M. Keyes
parent 0c1f783164
commit 2ea7bfc627
4 changed files with 84 additions and 21 deletions

View File

@@ -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()