Commit f9779a2c authored by Marco Kellershoff's avatar Marco Kellershoff 🤸

Make Taskfile async/non-blocking again

parent 0ecd3a8a
......@@ -51,21 +51,15 @@ endfunction
function! s:OnJobEventHandler(job_id, data, event) dict
if a:event == 'stdout'
let str = self.shell.' stdout: '.join(a:data)
let str = self.shell.''.join(a:data)
elseif a:event == 'stderr'
let str = self.shell.' stderr: '.join(a:data)
let str = self.shell.''.join(a:data)
else
let str = self.shell.' finished'
let str = self.shell
endif
echom str
endfunction
let s:termEventCallbacks = {
\ 'on_stdout': function('s:OnTermEventHandler'),
\ 'on_stderr': function('s:OnTermEventHandler'),
\ 'on_exit': function('s:OnTermEventHandler')
\ }
let s:jobEventCallbacks = {
\ 'on_stdout': function('s:OnJobEventHandler'),
\ 'on_stderr': function('s:OnJobEventHandler'),
......@@ -98,22 +92,22 @@ endfunction
function! s:ExecExternalCommand(command)
if has("nvim") == 1
if exists("g:TaskfileAsynchronous")
call jobstart(["bash", "-c", a:command])
else
if exists("g:TaskfileSynchronous")
execute "!" . a:command
else
call jobstart(["bash", "-c", a:command], extend({'shell': ''}, s:jobEventCallbacks))
endif
elseif v:version >= 800
if exists("g:TaskfileAsynchronous")
call job_start("bash -c " . a:command)
else
if exists("g:TaskfileSynchronous")
execute "!" . a:command
else
call job_start("bash -c " . a:command)
endif
else
if exists("g:TaskfileAsynchronous")
silent execute "!" . a:command
else
if exists("g:TaskfileSynchronous")
execute "!" . a:command
else
silent execute "!" . a:command
endif
endif
endfunction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment