aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-06-11 11:33:02 +1200
committerTom Ryder <tom@sanctum.geek.nz>2014-06-11 11:45:58 +1200
commit057b2900d559f65ef4fba00c0a0d7084d92ea073 (patch)
tree8bb310704aa89b5249d420341ba7613bd9d84506
parentAdd version detection (diff)
downloadnwatch-057b2900d559f65ef4fba00c0a0d7084d92ea073.tar.gz
nwatch-057b2900d559f65ef4fba00c0a0d7084d92ea073.zip
Catch ndiff(1) error condition properly
An exit value of 1 corresponds to there being some difference in the output, which means the diff never gets sent. This change will force the exit only if there's an actual error condition of 2, per the manual page for ndiff(1).
-rwxr-xr-xbin/nwatch6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/nwatch b/bin/nwatch
index 9eb0f40..6a35f84 100755
--- a/bin/nwatch
+++ b/bin/nwatch
@@ -53,7 +53,11 @@ fi
# If the link to the XML file is legible, run the diff or give up
if [[ -r ${latest}.xml ]] ; then
- if ! ndiff -- "$latest".xml "$cache".xml > "$diff" ; then
+ ndiff -- "$latest".xml "$cache".xml > "$diff"
+
+ # Because we always want a report, only exit if an actual error condition
+ # (1 means there's a meaningful diff in the scans)
+ if (($? == 2)) ; then
exit
fi
fi