Mercurial > vim-gutentags
changeset 33:aed756d6934e
Prevent lock and temp-File to remain after forced exit.
Added trap to remove those temporary files if the script gets stopped
unexpectedly (e.g. when vim is exited before the tag-file is fully
generated.)
Also changed /bin/sh to /bin/bash, because [[ ]] doesn't work with an
standard shell. You need at least bash.
author | Gerhard Siegesmund <gerhard.siegesmund@btd.de> |
---|---|
date | Wed, 29 Oct 2014 13:57:07 +0100 |
parents | 302b5e860fc3 |
children | a3ef2402ca09 |
files | plat/unix/update_tags.sh |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/plat/unix/update_tags.sh Tue Oct 21 20:21:31 2014 -0700 +++ b/plat/unix/update_tags.sh Wed Oct 29 13:57:07 2014 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -65,6 +65,9 @@ echo "Locking tags file..." echo $$ > "$TAGS_FILE.lock" +# Remove lock and temp file if script is stopped unexpectedly. +trap "rm -f \"$TAGS_FILE.lock\" \"$TAGS_FILE.temp\"" 0 3 4 15 + if [[ -f "$TAGS_FILE" ]]; then if [[ "$UPDATED_SOURCE" != "" ]]; then echo "Removing references to: $UPDATED_SOURCE"