Sunday, February 27, 2022

Out_cb callback handler in vim9

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>)
    # echomsg 'OutCb' .. string(l)
    # eval [][0]
  enddef

  def ExitCb(l: list<any>)
    # 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/441f1b0e-3e42-4749-b5e7-96d663cc23a1n%40googlegroups.com.

No comments:

Post a Comment