Sunday, May 8, 2016

Re: Understanding job_start()

On 2016-05-08 15:30:01 +0000, Nicola said:

> On 2016-05-07 14:21:15 +0000, Bram Moolenaar said:
>
>> Nicola wrote:
>>
>>> On 2016-05-07 07:04:44 +0000, Nicola said:
>>>>>>
>>>>>>
>>>>>> call job_start(['lualatex', 'foo.tex', '>/dev/null', '2>&1'],
>>>>>> \ {"in_io": "null", "out_io": "null", "err_io": "null"})
>>>>>>
>>>>>> This still fills the screen with the output from lualatex.
>>>
>>> Minimal example:
>>>
>>> vim -u NONE
>>> :call job_start(['echo','hello'],{"out_io":"null"})
>>>
>>> This prints 'hello' in the top-left corner of the screen.
>>
>> Surprisingly I can reproduce this. Will have to find out what goes
>> wrong, I thought this was working.
>>
>> I also see the job with "defunc" status.
>
> I have just tried patch 1824 and I confirm that this is solved. Thanks!
>
> Re:
>
>> I cannot send the output to a buffer either. When I try:
>>
>> :call job_start(['echo', 'hello'], {"out_io": "buffer", "out_name": ""})
>>
>> the new buffer contains only one line:
>>
>> Reading from channel output...
>>
>> But 'hello' is not appended. I have also tried to explicitly set "mode"
>> to "nl" or "raw", but the result is the same. Ditto for "err_io":"buffer".
>
> This still behaves the same. Am I misunderstanding how this feature is meant
> to be used?

I can make it work by adding an empty callback:

fun! MyCallback(channel, msg)
endf

call job_start(['echo', 'hello'], {"out_io": "buffer", "out_name": "",
"out_cb": "MyCallback"})

Is a callback really mandatory when out_io is "buffer", or is it a bug? The
manual says that out_cb is "Only for when the channel uses pipes", which I
interpret as "only when out_io is set to 'pipe'", but maybe I am wrong.

Also, is there a way to suppress the "Reading from channel output..." line?

Nicola


--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment