Sunday, February 27, 2022

Re: Out_cb callback handler in vim9

Thank you Yegappan ! 


Nota:probably missunderstood this with porting the legacy vimscript function that has argslist.

Fu foo(...) 

a0[i]

Endfu


Le dim. 27 févr. 2022 à 15:08, Yegappan Lakshmanan <yegappanl@gmail.com> a écrit :
Hi,

On Sun, Feb 27, 2022 at 4:27 AM Ni Va <nivaemail@gmail.com> wrote:
>
> Hi All,
>
> In §9 of channel help is mentionned the legacy vimscript out_cb handler.
>
>
> " let job = job_start(command, {"out_cb": "MyHandler"})
> The function will be called with the channel and a message. You would define
> it like this: >
>     func MyHandler(channel, msg)
>     "
>
>
> I tried this def OutCb function but got the following  message error :
>
> " def OutCb(l: list<any>)

As described in the help, this function should accept two arguments.  The first
argument is the channel and the second argument is the message string.

>     # echomsg 'OutCb' .. string(l)
>     # eval [][0]
>   enddef
>
>   def ExitCb(l: list<any>)

This function also should accept two arguments. The first argument is the job
and the second argument is the exit status number.

- Yegappan

>     # echomsg 'ExitCb' .. string(l)
>     # sleep 1m
>     # source += l
>     # echomsg 'Exiting ' .. string(l) .. ' ' .. string(@z)
>   enddef
>
>   jobid = job_start(zip_cmd, { out_cb: OutCb, exit_cb:  ExitCb, mode: 'raw', timeout: 1200000 } ) "
>
> Error message:
> " This is a valid directory .
>   Jobid: process 14328 run
>   Press ENTER or type command to continue
>   E118: Too many arguments for function: <lambda>4 "
>
>
> How to port and deal with this in vim9 script that seems to have only one
> argue ?
>
> Thank you
> Nv
>

--
--
You received this message from the "vim_use" 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 a topic in the Google Groups "vim_use" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/M65deWEN3O0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7mPGcK6GkO7hzVUq-F6XZDqBMXy%2BnibTMXCRhhUFhcAAw%40mail.gmail.com.

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAOKxv4F-kM8FO83-VcK86pBCnnCs7nadUda9Gg1T55gamA9VGQ%40mail.gmail.com.

No comments: