summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/job.vim2
-rw-r--r--test/test_prepare_command.vader17
2 files changed, 18 insertions, 1 deletions
diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim
index 2711e99f..33040bbf 100644
--- a/autoload/ale/job.vim
+++ b/autoload/ale/job.vim
@@ -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
diff --git a/test/test_prepare_command.vader b/test/test_prepare_command.vader
index ed9272ab..75e4c0c6 100644
--- a/test/test_prepare_command.vader
+++ b/test/test_prepare_command.vader
@@ -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'