Description
I know this is an old bug here, but I find something new that I can't understand here. I try to fix the error when I run :VimtexClean
, which will popup an error message:
E484: Can't open file C:\Users\usrname\AppData\Local\Temp\VIoF1B7.tmp
The problem is that the VIoF1B7.tmp
can be found at the exactly location, and can be deleted without any permission.
While debugging, I finally find that this line causes the problem:
silent call system(self.prepared_cmd)
If I comment it completely, all thing gone (of course no clean at all). It seems strange to me that the self.prepared_cmd
is
start /b cmd /s /c "cd /D "C:\Users\usrname\Desktop" & latexmk -c -outdir=C:\Users\usrname\vimfiles\myvim\vimtemp "test.tex" >nul"
and the self
discretionary is:
[['pid', 0], ['background', 1], ['continuous', 0], ['win32_restore_shell', 0], ['cmd', 'cd /D "C:\Users\usrname\Desktop" & latexmk -c -outdir=C:\Users\usrname\vimfiles\myvim\vimtemp "test.tex"'], ['stop', function('5084')], ['_execute', function('5088')], ['workdir', ''], ['get_pid', function('5092')], ['silent', 1], ['_do_not_run', function('5086')], ['pprint_items', function('5085')], ['prepared_cmd', 'start /b cmd /s /c "cd /D "C:\Users\usrname\Desktop" & latexmk -c -outdir=C:\Users\usrname\vimfiles\myvim\vimtemp "test.tex" >nul"'], ['_pre_run', function('5087')], ['output', 'null'], ['_post_run', function('5089')], ['run', function('5083')], ['_prepare', function('5090')], ['_restore', function('5091')]]
I learnt from this fix, that the VimtexClean
call can be fixed by surround the l:cmd
with double quote, while this fix violate the sumartpdf
previewer call. So I think a if
statement will work for this:
function! s:process._execute() abort dict " {{{1
if self.silent
echo items(self)
if self.output == 'null'
let self.prepared_cmd = '"' . self.prepared_cmd . '"'
endif
silent call system(self.prepared_cmd)
elseif self.background
silent execute '!' . self.prepared_cmd
if !has('gui_running')
redraw!
endif
else
execute '!' . self.prepared_cmd
endif
MY Question: I don't understand why there always a new temp file created whenever I call either VimtexCompile
or VimtexClean
, why we get such an error while the temp file exists?