Mercurial > vim
comparison src/testdir/test_channel.vim @ 10386:d3f0946b4a80 v8.0.0087
commit https://github.com/vim/vim/commit/7df915d113ac1981792c50e8b000c9f5f784b78b
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 17 17:25:32 2016 +0100
patch 8.0.0087
Problem: When the channel callback gets job info the job may already have
been deleted. (lifepillar)
Solution: Do not delete the job when the channel is still useful. (ichizok,
closes #1242, closes #1245)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 17 Nov 2016 17:30:04 +0100 |
parents | 88331ee68367 |
children | e664ee056a84 |
comparison
equal
deleted
inserted
replaced
10385:368468ef35cf | 10386:d3f0946b4a80 |
---|---|
1230 finally | 1230 finally |
1231 call job_stop(job) | 1231 call job_stop(job) |
1232 endtry | 1232 endtry |
1233 endfunc | 1233 endfunc |
1234 | 1234 |
1235 func Test_close_and_exit_cb() | |
1236 if !has('job') | |
1237 return | |
1238 endif | |
1239 call ch_log('Test_close_and_exit_cb') | |
1240 | |
1241 let dict = {'ret': {}} | |
1242 func dict.close_cb(ch) dict | |
1243 let self.ret['close_cb'] = job_status(ch_getjob(a:ch)) | |
1244 endfunc | |
1245 func dict.exit_cb(job, status) dict | |
1246 let self.ret['exit_cb'] = job_status(a:job) | |
1247 endfunc | |
1248 | |
1249 let g:job = job_start('echo', { | |
1250 \ 'close_cb': dict.close_cb, | |
1251 \ 'exit_cb': dict.exit_cb, | |
1252 \ }) | |
1253 call assert_equal('run', job_status(g:job)) | |
1254 unlet g:job | |
1255 call WaitFor('len(dict.ret) >= 2') | |
1256 call assert_equal(2, len(dict.ret)) | |
1257 call assert_match('^\%(dead\|run\)', dict.ret['close_cb']) | |
1258 call assert_equal('dead', dict.ret['exit_cb']) | |
1259 endfunc | |
1260 | |
1235 """""""""" | 1261 """""""""" |
1236 | 1262 |
1237 let g:Ch_unletResponse = '' | 1263 let g:Ch_unletResponse = '' |
1238 func s:UnletHandler(handle, msg) | 1264 func s:UnletHandler(handle, msg) |
1239 let g:Ch_unletResponse = a:msg | 1265 let g:Ch_unletResponse = a:msg |