fixed error on removing sort file too early
authorFred T. Hamster <fred@gruntose.com>
Thu, 5 Dec 2024 14:52:49 +0000 (09:52 -0500)
committerFred T. Hamster <fred@gruntose.com>
Thu, 5 Dec 2024 14:52:49 +0000 (09:52 -0500)
that file i cleaned up was actually needed across function calls.  did find the place where an error could leave the file lying around, and fixed that instead.

scripts/rev_control/version_control.sh

index 5c9bbe18c6dd0c34b1e092cda56514c0c6d3d868..02bf827af3420810af274e8446dd06afcf336fd4 100644 (file)
@@ -524,7 +524,7 @@ function generate_rev_ctrl_filelist()
   local sortfile=$(mktemp /tmp/zz_checkin_sort.XXXXXX)
   sort <"$tempfile" >"$sortfile"
   echo "$sortfile"
-  \rm "$tempfile" "$sortfile"
+  \rm "$tempfile"
 }
 
 # iterates across a list of directories contained in a file (first parameter).
@@ -546,7 +546,12 @@ function perform_revctrl_action_on_file()
     echo -n "[$(pwd)]  "
     # pass the current directory plus the remaining parameters from function invocation.
     $action . 
-    exit_on_error "performing action $action on: $(pwd)"
+    local retval=$?
+    if [ $retval -ne 0 ]; then
+      rm "$tempfile"
+      (exit $retval)  # re-assert the return value as our exit value.
+      exit_on_error "performing action $action on: $(pwd)"
+    fi
     popd &>/dev/null
   done 3<"$tempfile"