Skip to content

Commit bdf0bda

Browse files
committed
patch 7.4.1687
Problem: The channel close_cb option does not work. Solution: Use jo_close_partial instead of jo_err_partial. (Damien)
1 parent e9c0727 commit bdf0bda

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/channel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
11031103
*cbp = vim_strsave(opt->jo_close_cb);
11041104
else
11051105
*cbp = NULL;
1106-
*pp = opt->jo_err_partial;
1106+
*pp = opt->jo_close_partial;
11071107
if (*pp != NULL)
11081108
++(*pp)->pt_refcount;
11091109
}

src/testdir/test_channel.vim

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,6 +1203,29 @@ func Test_close_callback()
12031203
call s:run_server('s:test_close_callback')
12041204
endfunc
12051205

1206+
function s:test_close_partial(port)
1207+
let handle = ch_open('localhost:' . a:port, s:chopt)
1208+
if ch_status(handle) == "fail"
1209+
call assert_false(1, "Can't open channel")
1210+
return
1211+
endif
1212+
let s:d = {}
1213+
func s:d.closeCb(ch) dict
1214+
let self.close_ret = 'closed'
1215+
endfunc
1216+
call ch_setoptions(handle, {'close_cb': s:d.closeCb})
1217+
1218+
call assert_equal('', ch_evalexpr(handle, 'close me'))
1219+
call s:waitFor('"closed" == s:d.close_ret')
1220+
call assert_equal('closed', s:d.close_ret)
1221+
unlet s:d
1222+
endfunc
1223+
1224+
func Test_close_partial()
1225+
call ch_log('Test_close_partial()')
1226+
call s:run_server('s:test_close_partial')
1227+
endfunc
1228+
12061229
func Test_job_start_invalid()
12071230
call assert_fails('call job_start($x)', 'E474:')
12081231
call assert_fails('call job_start("")', 'E474:')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1687,
751753
/**/
752754
1686,
753755
/**/

0 commit comments

Comments
 (0)