diff options
author | w0rp <devw0rp@gmail.com> | 2019-02-08 21:33:07 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-02-08 21:33:16 +0000 |
commit | 422908a5721e11be73935b765f599f9fc672802e (patch) | |
tree | e03fa1fe57a21b62e8470e5f1859a60584db302b | |
parent | ba6f08f3d4944404caca074eafd08c16a6b31b96 (diff) | |
download | ale-422908a5721e11be73935b765f599f9fc672802e.zip |
#2009 - Force Windows jobs to run in a CMD shell
-rw-r--r-- | autoload/ale/command.vim | 2 | ||||
-rw-r--r-- | autoload/ale/job.vim | 18 | ||||
-rw-r--r-- | autoload/ale/lsp.vim | 7 |
3 files changed, 26 insertions, 1 deletions
diff --git a/autoload/ale/command.vim b/autoload/ale/command.vim index ceb642f0..89734685 100644 --- a/autoload/ale/command.vim +++ b/autoload/ale/command.vim @@ -293,6 +293,8 @@ function! ale#command#Run(buffer, command, Callback, options) abort let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1 let l:job_id = s:fake_job_id endif + elseif has('win32') + let l:job_id = ale#job#StartWithCmd(l:command, l:job_options) else let l:job_id = ale#job#Start(l:command, l:job_options) endif diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim index d4cda489..841a6379 100644 --- a/autoload/ale/job.vim +++ b/autoload/ale/job.vim @@ -276,6 +276,24 @@ function! ale#job#Start(command, options) abort return l:job_id endfunction +" Force running commands in a Windows CMD command line. +" This means the same command syntax works everywhere. +function! ale#job#StartWithCmd(command, options) abort + let l:shell = &l:shell + let l:shellcmdflag = &l:shellcmdflag + let &l:shell = 'cmd' + let &l:shellcmdflag = '/c' + + try + let l:job_id = ale#job#Start(a:command, a:options) + finally + let &l:shell = l:shell + let &l:shellcmdflag = l:shellcmdflag + endtry + + return l:job_id +endfunction + " Send raw data to the job. function! ale#job#SendRaw(job_id, string) abort if has('nvim') diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index 95ab83cf..5667b2e0 100644 --- a/autoload/ale/lsp.vim +++ b/autoload/ale/lsp.vim @@ -331,7 +331,12 @@ function! ale#lsp#StartProgram(conn_id, executable, command) abort \ 'mode': 'raw', \ 'out_cb': {_, message -> ale#lsp#HandleMessage(a:conn_id, message)}, \} - let l:job_id = ale#job#Start(a:command, l:options) + + if has('win32') + let l:job_id = ale#job#StartWithCmd(a:command, l:options) + else + let l:job_id = ale#job#Start(a:command, l:options) + endif else let l:job_id = l:conn.job_id endif |