On 2016-05-06 21:23:30 +0000, Bram Moolenaar said:
Nicola wrote:
On 2016-05-06 17:19:58 +0000, Nicola said:
Some time ago I had defined a thin wrapper around job_start() to run a LaTeX
job asynchronously. Recently, it has stopped working. For some reason, with Vim
7.4.1817, when I give the following command:
call job_start(['lualatex', 'foo.tex'])
the job is not started any longer (or, if it is, it dies immediately).
Suspecting some problem with I/O redirection, I have tried to set "out_io" and
"err_io". If I use:
call job_start(['lualatex', 'foo.tex'],
\ {"out_io": "null", "err_io": "null"})
the job is started, but the screen gets garbled with the output from lualatex,
and I need to :redraw! the screen.
To be clear, the above also happens if I close "in_io", too, as
explained in the
manual. And I've tried to add redirection in the command, too:
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.
What system is this on? What patch level?
OS X, Vim 7.4.1817 from Homebrew, compiled --with-lua --with-luajit.
If someone with a TeX installation wants to try to reproduce, this is
the code I am using:
fun! lf_shell#async_run(cmd, ...)
let l:callback = a:0 > 0 ? a:1 : 'lf_shell#callback'
call job_start(a:cmd, {"exit_cb": l:callback, "in_io": "null",
"out_io": "null", "err_io": "null"})
endf
fun! lf_shell#callback(job, status)
if a:status == 0
echo "Success!"
else
echo "Job failed."
endif
endf
let g:latexmk = split('latexmk -lualatex -cd -pv- -synctex=1
-file-line-error -interaction=nonstopmode')
command! -nargs=0 LuaLaTeX echo "Typesetting..."<bar>
\ call lf_shell#async_run(g:latexmk+[expand('%:p')])
You mention a callback, but your code doesn't show any callback.
If you mean the exit_cb for the job, that is indeed called after some
delay. You can speed it up by calling job_status(), e.g. in the channel
close callback.
Ah, ok. As you see from the code above, I indeed use exit_cb. I will change my
code to keep track of the job status as you suggest (currently, I am discarding
job_start()'s return value).
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.