Mercurial > vim-gutentags
changeset 37:0c67b56abc63
Attempt at better error handling with the Windows update script.
* Use `call` to run Ctags because apparently, the way Vim runs background
Windows scripts means the whole thing will abort if there's an error.
But here we want to keep going so we get a chance to unlock the tags file
if possible.
* Add some `ERRORLEVEL` handling code.
* Log more stuff to the log file.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 15 Dec 2014 13:00:04 -0800 |
parents | 186b65facdb1 |
children | e068c5039756 |
files | plat/win32/update_tags.cmd |
diffstat | 1 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plat/win32/update_tags.cmd Mon Dec 15 12:57:54 2014 -0800 +++ b/plat/win32/update_tags.cmd Mon Dec 15 13:00:04 2014 -0800 @@ -83,15 +83,27 @@ ) echo Running ctags >> %LOG_FILE% -echo "%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% %PROJECT_ROOT% >> %LOG_FILE% -"%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% %PROJECT_ROOT% +echo call "%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% %PROJECT_ROOT% >> %LOG_FILE% +call "%CTAGS_EXE%" -R -f "%TAGS_FILE%.temp" %CTAGS_ARGS% %PROJECT_ROOT% >> %LOG_FILE% 2>&1 +if ERRORLEVEL 1 ( + echo ERROR: Ctags executable returned non-zero code. >> %LOG_FILE% + goto :Unlock +) echo Replacing tags file >> %LOG_FILE% echo move /Y "%TAGS_FILE%.temp" "%TAGS_FILE%" >> %LOG_FILE% -move /Y "%TAGS_FILE%.temp" "%TAGS_FILE%" >NUL 2>&1 +move /Y "%TAGS_FILE%.temp" "%TAGS_FILE%" >> %LOG_FILE% 2>&1 +if ERRORLEVEL 1 ( + echo ERROR: Unable to rename temp tags file into actual tags file. >> %LOG_FILE% + goto :Unlock +) +:Unlock echo Unlocking tags file... >> %LOG_FILE% del /F "%TAGS_FILE%.lock" +if ERRORLEVEL 1 ( + echo ERROR: Unable to remove file lock. >> %LOG_FILE% +) echo Done. >> %LOG_FILE% if [%PAUSE_BEFORE_EXIT%]==[1] (