While I was trying to write some vim code for testing a (async) functionality
for Neomake plugin, I've noticed the following scenario:
- Having the following shell script (with errors):
#!/bin/sh
a='$var'
foo(
- And the next vim test code:
function! StartJob()
let g:job = job_start(['/bin/sh', 'errors.sh'], {
\ 'callback': 'HandlerCallback',
\ 'close_cb': 'HandlerClose',
\ 'exit_cb': 'HandlerExit'
\ })
endfunction
function! HandlerCallback(channel, line) abort
call Debug('[Callback] channel: ' . a:channel . ', line: ' . a:line . ',
channelStatus: ' . ch_status(a:channel))
endfunction
function! HandlerClose(channel) abort
call Debug('[Close] channel: ' . a:channel . ', channelStatus: ' .
ch_status(a:channel))
endfunction
function! HandlerExit(job, status) abort
call Debug('[Exit] job: ' . a:job . ', status: ' . a:status . ', jobStatus:
' . job_status(a:job))
endfunction
function! Debug(msg) abort
call writefile([a:msg], 'output.log', 'a')
endfunction
command! -bar RunJob call StartJob()
- Then the following thing happens:
- RunJob # Works OK, both HandlerCallback (with data) and HandlerClose are
called
- RunJob | sleep 50m # Does not work, only HandlerClose and HandlerExit are
being called (no buffered data)
The reason I need the sleep is that I want to check every 50m for the
job_status in order to continue with some test assertions.
Also, I've noticed that this does not happen with other commands... Is there
something special about /bin/sh?
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.