Fix #1495 - Fall back to /bin/sh when shell=pwsh

This commit is contained in:
w0rp 2018-04-12 21:01:35 +01:00
parent 36a3932ce8
commit 0e4a7a7187
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
2 changed files with 18 additions and 1 deletions

View file

@ -208,7 +208,7 @@ function! ale#job#PrepareCommand(buffer, command) abort
return 'cmd /s/c "' . l:command . '"'
endif
if &shell =~? 'fish$'
if &shell =~? 'fish$\|pwsh$'
return ['/bin/sh', '-c', l:command]
endif

View file

@ -22,6 +22,23 @@ Execute(sh should be used when the shell is fish):
AssertEqual ['/bin/sh', '-c', 'foobar'], ale#job#PrepareCommand(bufnr(''), 'foobar')
endif
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
Execute(Other shells should be used when set):
if !has('win32')
let &shell = '/bin/bash'