]> granicus.if.org Git - vim/commitdiff
patch 7.4.2287 v7.4.2287
authorBram Moolenaar <Bram@vim.org>
Sun, 28 Aug 2016 17:26:43 +0000 (19:26 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 28 Aug 2016 17:26:43 +0000 (19:26 +0200)
Problem:    The callback passed to ch_sendraw() is not used.
Solution:   Pass the read part, not the send part. (haya14busa, closes #1019)

src/channel.c
src/testdir/test_channel.vim
src/version.c

index 74885742384adc8385baf7fee4f35a94e33a9b5b..81c43a5d425a0578889e01204fda83fae686db92 100644 (file)
@@ -3456,7 +3456,7 @@ send_common(
            EMSG2(_("E917: Cannot use a callback with %s()"), fun);
            return NULL;
        }
-       channel_set_req_callback(channel, part_send,
+       channel_set_req_callback(channel, *part_read,
                                       opt->jo_callback, opt->jo_partial, id);
     }
 
index 6ecbc789aa6d52f2e626cfb8513e591406a4ba20..a038d4a2dff19ee379b42713d32d2cdec5ac4e94 100644 (file)
@@ -245,7 +245,6 @@ endfunc
 
 """""""""
 
-let g:Ch_reply = ""
 func Ch_handler(chan, msg)
   unlet g:Ch_reply
   let g:Ch_reply = a:msg
@@ -271,8 +270,10 @@ endfunc
 
 func Test_channel_handler()
   call ch_log('Test_channel_handler()')
+  let g:Ch_reply = ""
   let s:chopt.callback = 'Ch_handler'
   call s:run_server('Ch_channel_handler')
+  let g:Ch_reply = ""
   let s:chopt.callback = function('Ch_handler')
   call s:run_server('Ch_channel_handler')
   unlet s:chopt.callback
@@ -443,6 +444,11 @@ func Test_raw_pipe()
     let msg = ch_readraw(job)
     call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
 
+    let g:Ch_reply = ""
+    call ch_sendraw(job, "double this\n", {'callback': 'Ch_handler'})
+    call WaitFor('"" != g:Ch_reply')
+    call assert_equal("this\nAND this\n", substitute(g:Ch_reply, "\r", "", 'g'))
+
     let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
     call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
   finally
index a18ce1e17446c046208ba075a703bfb068f37d11..8ed1a1396d9cb23891c1064dae76bcd0a50f53c9 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2287,
 /**/
     2286,
 /**/