async.vim
async.vim copied to clipboard
Bug in the Readme example
Hi, I just tried out the example from the Readme and it crashes in the handler on_exit
due to a:data
being of type number
and not list
.
function! s:handler(job_id, data, event_type)
echo a:job_id . ' ' . a:event_type
" Error happens here as join() expects a list
echo join(a:data, "\n")
endfunction
Am I correct that this is simply a bug because on_exit
returns the status code of the command?
I am running Vim version 8.2 1-4745
.
Seems like a bug in readme sample code and not in async.vim. Thanks for catching!
You can check the a:event_type
to be stdout
or stderr
or create a different handler for on_exit
.
Feel free to send a PR to update the sample.