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.
This commit is contained in:
Avery Pennarun 2010-12-11 20:36:42 -08:00
commit a75555e7a8

View file

@ -61,8 +61,9 @@ _do()
[ -z "$RV" ] && mv "$TARGET.tmp" "$TARGET" 2>/dev/null [ -z "$RV" ] && mv "$TARGET.tmp" "$TARGET" 2>/dev/null
: >>"$TARGET" : >>"$TARGET"
if [ -n "$RV" ]; then if [ -n "$RV" ]; then
printf "do: %s%s\n" "$DO_DEPTH" "got exit code $RV" >&2 printf "do: %s%s\n" "$DO_DEPTH" \
exit $RV "$DIR$TARGET: got exit code $RV" >&2
return $RV
fi fi
else else
echo "do $DO_DEPTH$TARGET exists." >&2 echo "do $DO_DEPTH$TARGET exists." >&2
@ -74,7 +75,7 @@ redo()
{ {
for i in "$@"; do for i in "$@"; do
_dirsplit "$i" _dirsplit "$i"
( cd "$dir" && _do "$dir" "$base" ) || exit $? ( cd "$dir" && _do "$dir" "$base" ) || return 1
done done
} }