Sunday, February 27, 2022

Re: Out_cb callback handler in vim9

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 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/CAAW7x7mPGcK6GkO7hzVUq-F6XZDqBMXy%2BnibTMXCRhhUFhcAAw%40mail.gmail.com.

No comments: