From a75555e7a854b289afff83328cb52e098efac7c1 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 11 Dec 2010 20:36:42 -0800 Subject: [PATCH] minimal/do: don't completely abort if a sub-redo fails. Just allow that sub-redo to return an error code. Also, parent redos should return error code 1, not the same code as the child. That makes it easier to figure out which file generated the "special" error code. --- minimal/do | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/minimal/do b/minimal/do index 8272604..d1262c8 100755 --- a/minimal/do +++ b/minimal/do @@ -61,8 +61,9 @@ _do() [ -z "$RV" ] && mv "$TARGET.tmp" "$TARGET" 2>/dev/null : >>"$TARGET" if [ -n "$RV" ]; then - printf "do: %s%s\n" "$DO_DEPTH" "got exit code $RV" >&2 - exit $RV + printf "do: %s%s\n" "$DO_DEPTH" \ + "$DIR$TARGET: got exit code $RV" >&2 + return $RV fi else echo "do $DO_DEPTH$TARGET exists." >&2 @@ -74,7 +75,7 @@ redo() { for i in "$@"; do _dirsplit "$i" - ( cd "$dir" && _do "$dir" "$base" ) || exit $? + ( cd "$dir" && _do "$dir" "$base" ) || return 1 done }