Skip to content

Commit 6fc8227

Browse files
committed
patch 7.4.2287
Problem: The callback passed to ch_sendraw() is not used. Solution: Pass the read part, not the send part. (haya14busa, closes macvim-dev#1019)
1 parent fec246d commit 6fc8227

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/channel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3456,7 +3456,7 @@ send_common(
34563456
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
34573457
return NULL;
34583458
}
3459-
channel_set_req_callback(channel, part_send,
3459+
channel_set_req_callback(channel, *part_read,
34603460
opt->jo_callback, opt->jo_partial, id);
34613461
}
34623462

src/testdir/test_channel.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ endfunc
245245

246246
"""""""""
247247

248-
let g:Ch_reply = ""
249248
func Ch_handler(chan, msg)
250249
unlet g:Ch_reply
251250
let g:Ch_reply = a:msg
@@ -271,8 +270,10 @@ endfunc
271270

272271
func Test_channel_handler()
273272
call ch_log('Test_channel_handler()')
273+
let g:Ch_reply = ""
274274
let s:chopt.callback = 'Ch_handler'
275275
call s:run_server('Ch_channel_handler')
276+
let g:Ch_reply = ""
276277
let s:chopt.callback = function('Ch_handler')
277278
call s:run_server('Ch_channel_handler')
278279
unlet s:chopt.callback
@@ -443,6 +444,11 @@ func Test_raw_pipe()
443444
let msg = ch_readraw(job)
444445
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
445446

447+
let g:Ch_reply = ""
448+
call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'})
449+
call WaitFor('"" != g:Ch_reply')
450+
call assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 'g'))
451+
446452
let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
447453
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
448454
finally

src/version.c

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

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2287,
766768
/**/
767769
2286,
768770
/**/

0 commit comments

Comments
 (0)