From a03ccd82b6efb1f61db83c7652c6b0b759a8d9dc Mon Sep 17 00:00:00 2001 From: Konfekt Date: Wed, 10 Dec 2014 20:10:29 +0100 Subject: [PATCH] make continuous latexmk more robust under MS Windows --- autoload/latex/latexmk.vim | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/autoload/latex/latexmk.vim b/autoload/latex/latexmk.vim index 1f28bd1..ee9091c 100644 --- a/autoload/latex/latexmk.vim +++ b/autoload/latex/latexmk.vim @@ -354,14 +354,13 @@ endfunction " }}}1 function! s:latexmk_set_pid(data) " {{{1 if has('win32') - let tmpfile = tempname() - silent execute '!cmd /c "wmic process where ' - \ . '(CommandLine LIKE "latexmk\%' . a:data.base . '\%") ' - \ . 'get ProcessId /value' - \ . '| \%systemroot\%\system32\find "ProcessId" ' - \ . '>' . tmpfile . ' "' - let pids = readfile(tmpfile) - let a:data.pid = strpart(pids[0], 10) + " Use qprocess instead of wmic because this is available in Windows XP + " Home Edition whereas wmic only from Windows 7 upwards. + " The latexmk process just started is last in the list given by qprocess. + let pidcmd = 'qprocess latexmk.exe' + let pidinfo = systemlist(pidcmd)[-1] + let a:data.pid = split(pidinfo,'\s\+')[-2] + else let a:data.pid = system('pgrep -nf "^perl.*latexmk"')[:-2] endif