Permalink
Browse files

Fix job-runner termination

the order of job-close_cb and job-exit_cb is indeterminate.
  • Loading branch information...
1 parent 16fccba commit 067984b121176d5dbf7fa60a8fd43d769874302d @ichizok ichizok committed Dec 13, 2016
Showing with 14 additions and 1 deletion.
  1. +14 −1 autoload/quickrun/runner/job.vim
@@ -28,6 +28,7 @@ function! s:runner.run(commands, input, session) abort
let options = {
\ 'mode': 'raw',
\ 'callback': self._job_cb,
+ \ 'close_cb': self._job_close_cb,
\ 'exit_cb': self._job_exit_cb,
\ }
if a:input ==# ''
@@ -63,8 +64,20 @@ function! s:runner._job_cb(channel, message) abort
call quickrun#session(self._key, 'output', a:message)
endfunction
+function! s:runner._job_close_cb(channel) abort
+ if has_key(self, '_job_exited')
+ call quickrun#session(self._key, 'finish', self._job_exited)
+ else
+ let self._job_exited = 0
+ endif
+endfunction
+
function! s:runner._job_exit_cb(job, exit_status) abort
- call quickrun#session(self._key, 'finish', a:exit_status)
+ if has_key(self, '_job_exited')
+ call quickrun#session(self._key, 'finish', a:exit_status)
+ else
+ let self._job_exited = a:exit_status
+ endif
endfunction
function! s:runner._timer_cb(timer) abort

0 comments on commit 067984b

Please sign in to comment.