commit 061574850402ee025bfa2dc41b35707645b0199f
parent 4a63926e09758b6513639ea976107c966f9777b6
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 4 Oct 2016 23:09:50 +0200
fix bug in error handling
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/svn-poll b/svn-poll
@@ -5,7 +5,7 @@
# once a log has been shown, svn-poll will shut up until $USER commits
# or svn-poll-drop is called
-# after this many failures, complain
+# after this many lines of failure, complain
MAX_ERRORS="100"
DIFF_MAX="10000"
@@ -16,16 +16,19 @@ DIR="$HOME/temp/svn-poll/$BASE"
FILE="$DIR/rev"
MUTEFILE="$DIR/muted"
ERRORS="$DIR/errors"
+TEMP=$(mktemp)
mkdir -p "$DIR"
-LATEST="$(svn info "$URL" | grep Revision | cut -d' ' -f2)"
+LATEST="$(svn info "$URL" 2>$TEMP | grep Revision | cut -d' ' -f2)"
# http://stackoverflow.com/a/806923/414272
re='^[0-9]+$'
if ! [[ $LATEST =~ $re ]] ; then
# importantly, don't save $LATEST then
# log the error
+ cat "$TEMP" >> "$ERRORS"
+ rm "$TEMP"
echo "problem when fetching latest revision: got $LATEST" >>"$ERRORS"
# now, should we whine...
NERRORS=$(cat "$ERRORS" | wc -l)