Problem: Can't remove a callback with ch_setoptions().
Solution: When passing zero or an empty string remove the callback.
channel->ch_job = job;
}
-/*
- * Set the callback for channel "channel".
- */
- void
-channel_set_callback(channel_T *channel, char_u *callback)
-{
- vim_free(channel->ch_callback);
- channel->ch_callback = vim_strsave(callback);
-}
-
/*
* Set various properties from an "options" argument.
*/
if (options->jo_set & JO_TIMEOUT)
channel->ch_timeout = options->jo_timeout;
- if ((options->jo_set & JO_CALLBACK)
- && options->jo_callback != NULL && *options->jo_callback != NUL)
- channel_set_callback(channel, options->jo_callback);
+ if (options->jo_set & JO_CALLBACK)
+ {
+ vim_free(channel->ch_callback);
+ if (options->jo_callback != NULL && *options->jo_callback != NUL)
+ channel->ch_callback = vim_strsave(options->jo_callback);
+ else
+ channel->ch_callback = NULL;
+ }
}
/*
channel_T *channel_open(char *hostname, int port_in, int waittime, void (*close_cb)(void));
void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err);
void channel_set_job(channel_T *channel, job_T *job);
-void channel_set_callback(channel_T *channel, char_u *callback);
void channel_set_options(channel_T *channel, jobopt_T *options);
void channel_set_req_callback(channel_T *channel, char_u *callback, int id);
char_u *channel_get(channel_T *channel);
call ch_setoptions(handle, {'timeout': 1111})
call assert_fails("call ch_setoptions(handle, {'waittime': 111})", "E475")
call assert_fails("call ch_setoptions(handle, {'mode': 'json'})", "E475")
+ call ch_setoptions(handle, {'callback': ''})
" Send an eval request that works.
call assert_equal('ok', ch_sendexpr(handle, 'eval-works'))
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1360,
/**/
1359,
/**/