diff autoload/gutentags/ctags.vim @ 267:6030953258fe

On Windows, kill ongoing jobs before leaving so we can clean-up temp files
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 12 May 2022 09:20:21 -0700
parents 81d51b4a2a78
children 8ddbcbfa57b2
line wrap: on
line diff
--- a/autoload/gutentags/ctags.vim	Fri Feb 25 22:12:42 2022 +0800
+++ b/autoload/gutentags/ctags.vim	Thu May 12 09:20:21 2022 -0700
@@ -214,12 +214,20 @@
 endfunction
 
 function! gutentags#ctags#on_job_exit(job, exit_val) abort
-    call gutentags#remove_job_by_data('ctags', a:job)
+    let [l:tags_file, l:job_data] = gutentags#remove_job_by_data('ctags', a:job)
 
     if a:exit_val != 0 && !g:__gutentags_vim_is_leaving
         call gutentags#warning("ctags job failed, returned: ".
                     \string(a:exit_val))
     endif
+    if has('win32') && g:__gutentags_vim_is_leaving
+        " The process got interrupted because Vim is quitting.
+        " Remove the tags and lock files on Windows because there's no `trap`
+        " statement in update script.
+        try | call delete(l:tags_file) | endtry
+        try | call delete(l:tags_file.'.temp') | endtry
+        try | call delete(l:tags_file.'.lock') | endtry
+    endif
 endfunction
 
 " }}}