use job for s:system() on vim8
This commit is contained in:
parent
f551a71688
commit
90ad03408e
12
plug.vim
12
plug.vim
|
@ -1979,11 +1979,21 @@ endfunction
|
||||||
|
|
||||||
function! s:system(cmd, ...)
|
function! s:system(cmd, ...)
|
||||||
try
|
try
|
||||||
|
let maxfuncdepth = &maxfuncdepth
|
||||||
|
set maxfuncdepth=99999
|
||||||
let [sh, shrd] = s:chsh(1)
|
let [sh, shrd] = s:chsh(1)
|
||||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||||
|
if s:vim8
|
||||||
|
let out = ''
|
||||||
|
let job = job_start([&shell, &shellcmdflag, cmd], {'out_cb': {ch,msg->[execute("let out .= msg"), out]}, 'out_mode': 'raw'})
|
||||||
|
while job_status(job) == 'run'
|
||||||
|
sleep 10m
|
||||||
|
endwhile
|
||||||
|
return out
|
||||||
|
endif
|
||||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||||
finally
|
finally
|
||||||
let [&shell, &shellredir] = [sh, shrd]
|
let [&shell, &shellredir, &maxfuncdepth] = [sh, shrd, maxfuncdepth]
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user