2017-07-10 20:35:35 +00:00
|
|
|
Before:
|
|
|
|
Save &shell
|
|
|
|
Save &shellcmdflag
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
Execute(sh should be used when the shell is fish):
|
2017-12-20 12:20:38 +00:00
|
|
|
if !has('win32')
|
|
|
|
" Set something else, so we will replace that too.
|
|
|
|
let &shellcmdflag = '-f'
|
|
|
|
let &shell = 'fish'
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
let &shell = '/usr/bin/fish'
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
let &shell = '/usr/local/bin/fish'
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
endif
|
2017-07-10 20:35:35 +00:00
|
|
|
|
|
|
|
Execute(Other shells should be used when set):
|
2017-12-20 12:20:38 +00:00
|
|
|
if !has('win32')
|
|
|
|
let &shell = '/bin/bash'
|
|
|
|
let &shellcmdflag = '-c'
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2017-12-20 12:20:38 +00:00
|
|
|
AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
endif
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2018-01-17 18:08:17 +00:00
|
|
|
Execute(cmd /s/c as a string should be used on Windows):
|
2017-12-20 12:20:38 +00:00
|
|
|
if has('win32')
|
|
|
|
let &shell = 'who cares'
|
|
|
|
let &shellcmdflag = 'whatever'
|
2017-07-10 20:35:35 +00:00
|
|
|
|
2018-01-17 18:08:17 +00:00
|
|
|
AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-12-20 12:20:38 +00:00
|
|
|
endif
|