changeset 109:d287d2a72015

unix: return proper error code from `trap' action Use single quotes for `trap' action. This way `$?' is evaluated when action is executed, not when `trap' is defined.
author Ilya Tumaykin <itumaykin@gmail.com>
date Mon, 22 Feb 2016 05:05:13 +0300
parents d7db67728279
children f1a6cdd692f0
files plat/unix/update_scopedb.sh plat/unix/update_tags.sh
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plat/unix/update_scopedb.sh	Mon Feb 22 03:50:50 2016 +0300
+++ b/plat/unix/update_scopedb.sh	Mon Feb 22 05:05:13 2016 +0300
@@ -47,7 +47,7 @@
 echo $$ > "$DB_FILE.lock"
 
 # Remove lock and temp file if script is stopped unexpectedly.
-trap "rm -f \"$DB_FILE.lock\" \"$DB_FILE.temp\"" 0 3 4 15
+trap 'rm -f "$DB_FILE.lock" "$DB_FILE.temp"' 0 3 4 15
 
 PREVIOUS_DIR=$(pwd)
 if [ -d "$PROJECT_ROOT" ]; then
--- a/plat/unix/update_tags.sh	Mon Feb 22 03:50:50 2016 +0300
+++ b/plat/unix/update_tags.sh	Mon Feb 22 05:05:13 2016 +0300
@@ -67,7 +67,7 @@
 echo $$ > "$TAGS_FILE.lock"
 
 # Remove lock and temp file if script is stopped unexpectedly.
-trap "errorcode=$?; rm -f \"$TAGS_FILE.lock\" \"$TAGS_FILE.temp\"; exit $errorcode" INT TERM EXIT
+trap 'errorcode=$?; rm -f "$TAGS_FILE.lock" "$TAGS_FILE.temp"; exit $errorcode' INT TERM EXIT
 
 INDEX_WHOLE_PROJECT=1
 if [ -f "$TAGS_FILE" ]; then