Patch 7.4.1509
Problem: Keeping both a variable for a job and the channel it refers to is
a hassle.
Solution: Allow passing the job where a channel is expected. (Damien)
Files: src/eval.c, src/testdir/test_channel.vim
*** ../vim-7.4.1508/src/eval.c 2016-03-07 15:23:59.946423625 +0100
--- src/eval.c 2016-03-07 21:10:57.218766358 +0100
***************
*** 10285,10298 ****
static channel_T *
get_channel_arg(typval_T *tv)
{
! channel_T *channel;
! if (tv->v_type != VAR_CHANNEL)
{
EMSG2(_(e_invarg2), get_tv_string(tv));
return NULL;
}
- channel = tv->vval.v_channel;
if (channel == NULL || !channel_is_open(channel))
{
--- 10285,10306 ----
static channel_T *
get_channel_arg(typval_T *tv)
{
! channel_T *channel = NULL;
! if (tv->v_type == VAR_JOB)
! {
! if (tv->vval.v_job != NULL)
! channel = tv->vval.v_job->jv_channel;
! }
! else if (tv->v_type == VAR_CHANNEL)
! {
! channel = tv->vval.v_channel;
! }
! else
{
EMSG2(_(e_invarg2), get_tv_string(tv));
return NULL;
}
if (channel == NULL || !channel_is_open(channel))
{
***************
*** 15106,15112 ****
* "job_start()" function
*/
static void
! f_job_start(typval_T *argvars UNUSED, typval_T *rettv)
{
job_T *job;
char_u *cmd = NULL;
--- 15114,15120 ----
* "job_start()" function
*/
static void
! f_job_start(typval_T *argvars, typval_T *rettv)
{
job_T *job;
char_u *cmd = NULL;
*** ../vim-7.4.1508/src/testdir/test_channel.vim 2016-03-06
23:06:20.671506716 +0100
--- src/testdir/test_channel.vim 2016-03-07 21:11:58.878117058 +0100
***************
*** 463,478 ****
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
call assert_equal("run", job_status(job))
try
! let handle = job_getchannel(job)
! call ch_sendraw(handle, "echo something\n")
! let msg = ch_readraw(handle)
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
! call ch_sendraw(handle, "double this\n")
! let msg = ch_readraw(handle)
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
! let reply = ch_evalraw(handle, "quit\n", {'timeout': 100})
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
finally
call job_stop(job)
--- 463,478 ----
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
call assert_equal("run", job_status(job))
try
! " For a change use the job where a channel is expected.
! call ch_sendraw(job, "echo something\n")
! let msg = ch_readraw(job)
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
! call ch_sendraw(job, "double this\n")
! let msg = ch_readraw(job)
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
! let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
finally
call job_stop(job)
*** ../vim-7.4.1508/src/version.c 2016-03-07 20:58:45.922477535 +0100
--- src/version.c 2016-03-07 21:09:56.699403778 +0100
***************
*** 745,746 ****
--- 745,748 ----
{ /* Add new patch number below this line */
+ /**/
+ 1509,
/**/
--
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.