2017-07-10 16:35:35 -04:00
|
|
|
Before:
|
|
|
|
Save &shell
|
|
|
|
Save &shellcmdflag
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
2018-12-28 11:58:55 -05:00
|
|
|
let g:ale_shell = &shell
|
2017-07-10 16:35:35 -04:00
|
|
|
|
|
|
|
Execute(sh should be used when the shell is fish):
|
2017-12-20 07:20:38 -05:00
|
|
|
if !has('win32')
|
|
|
|
" Set something else, so we will replace that too.
|
|
|
|
let &shellcmdflag = '-f'
|
|
|
|
let &shell = 'fish'
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
let &shell = '/usr/bin/fish'
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
let &shell = '/usr/local/bin/fish'
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
endif
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2018-04-12 16:01:35 -04:00
|
|
|
Execute(sh should be used when the shell is powershell):
|
|
|
|
if !has('win32')
|
|
|
|
" Set something else, so we will replace that too.
|
|
|
|
let &shellcmdflag = '-f'
|
|
|
|
let &shell = 'pwsh'
|
|
|
|
|
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
|
|
|
|
let &shell = '/usr/bin/pwsh'
|
|
|
|
|
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
|
|
|
|
let &shell = '/usr/local/bin/pwsh'
|
|
|
|
|
|
|
|
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
endif
|
|
|
|
|
2017-07-10 16:35:35 -04:00
|
|
|
Execute(Other shells should be used when set):
|
2017-12-20 07:20:38 -05:00
|
|
|
if !has('win32')
|
|
|
|
let &shell = '/bin/bash'
|
|
|
|
let &shellcmdflag = '-c'
|
2018-12-28 11:58:55 -05:00
|
|
|
let g:ale_shell = &shell
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2017-12-20 07:20:38 -05:00
|
|
|
AssertEqual ['/bin/bash', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
|
|
|
|
endif
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2018-01-17 13:08:17 -05:00
|
|
|
Execute(cmd /s/c as a string should be used on Windows):
|
2017-12-20 07:20:38 -05:00
|
|
|
if has('win32')
|
|
|
|
let &shell = 'who cares'
|
|
|
|
let &shellcmdflag = 'whatever'
|
2017-07-10 16:35:35 -04:00
|
|
|
|
2018-01-17 13:08:17 -05:00
|
|
|
AssertEqual 'cmd /s/c "foobar"', ale#job#PrepareCommand(bufnr(''), 'foobar')
|
2017-12-20 07:20:38 -05:00
|
|
|
endif
|
2018-12-28 11:58:55 -05:00
|
|
|
|
|
|
|
Execute(Setting ale_shell should cause ale#job#PrepareCommand to use set shell):
|
2018-12-28 12:51:01 -05:00
|
|
|
if !has('win32')
|
|
|
|
let g:ale_shell = '/foo/bar'
|
2018-12-28 11:58:55 -05:00
|
|
|
|
2018-12-28 12:51:01 -05:00
|
|
|
AssertEqual ['/foo/bar', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), "foobar")
|
|
|
|
endif
|