Commit 2ee73aa1 authored by intrigeri's avatar intrigeri
Browse files

Fix error handling for the diff(1) command.

One can't get expr's return code with "if ! expr ; then ..."
parent dbc5bca8
......@@ -145,22 +145,23 @@ esac
sort_packages_list_inplace "$OLDLIST"
sort_packages_list_inplace "$NEWLIST"
if ! diff -Naur "$OLDLIST" "$NEWLIST" ; then
RET=$?
case "$RET" in
0|1)
# diff did its job just fine
:
;;
2)
# diff had trouble
error "diff(1) failed."
;;
*)
# undocumented diff exit code
error "diff(1) returned $? -- I don't know what it means."
;;
esac
fi
set +e
diff -Naur "$OLDLIST" "$NEWLIST"
RET=$?
set -e
case "$RET" in
0|1)
# diff did its job just fine
:
;;
2)
# diff had trouble
error "diff(1) failed."
;;
*)
# undocumented diff exit code
error "diff(1) returned $? -- I don't know what it means."
;;
esac
rm -rf "$WORKDIR"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment