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:
parent
fba684ee07
commit
a75555e7a8
1 changed files with 4 additions and 3 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue