Created
July 14, 2016 20:11
-
-
Save mhinz/1e332b4552130fdc5bf36234fe4da754 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:buf = [] | |
function! s:error(msgs) | |
redraw | |
echohl ErrorMsg | |
for line in a:msgs | |
echomsg line | |
endfor | |
echohl NONE | |
endfunction | |
function! s:on_stdout(id, data) | |
let s:buf += a:data | |
endfunction | |
function! s:on_exit(id) | |
call s:error(filter(s:buf, '!empty(v:val)')) | |
endfunction | |
call jobstart('echo foo && echo bar', { | |
\ 'on_stdout': function('s:on_stdout'), | |
\ 'on_exit': function('s:on_exit'), | |
\ }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment