From d251e782d9fe66d64035fcc4db92dc1c98ad3190 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 2 Nov 2013 22:57:04 -0400 Subject: add offlineimap-exit: it returns a non-zero exit status for errors --- .gitignore | 1 + Makefile | 1 + offlineimap-exit.sh | 11 +++++++++++ offlineimap-runner.sh | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 offlineimap-exit.sh diff --git a/.gitignore b/.gitignore index 7fb01dd..d807476 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ hangman-helper maildups newegg offlineimap-runner +offlineimap-exit ord roll sysfiles diff --git a/Makefile b/Makefile index 6db00cb..d242d1c 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ BINFILES = \ maildups \ newegg \ offlineimap-runner \ + offlineimap-exit \ ord \ roll \ sysfiles \ diff --git a/offlineimap-exit.sh b/offlineimap-exit.sh new file mode 100644 index 0000000..17861ba --- /dev/null +++ b/offlineimap-exit.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +offlineimap='offlineimap' +output_file="`mktemp`" + +$offlineimap "$@" 2>&1|tee "$output_file" + +[ -z "`grep 'ERROR:' "$output_file"`" ] +status=$? +rm "$output_file" +exit $status diff --git a/offlineimap-runner.sh b/offlineimap-runner.sh index 4828f35..189bda3 100644 --- a/offlineimap-runner.sh +++ b/offlineimap-runner.sh @@ -32,7 +32,7 @@ default_limit=2 limit=${1-$default_limit} cookie_file="$HOME/.offlineimap.cookie" -offlineimap='offlineimap -u quiet' +offlineimap='offlineimap-exit' # Try running offlineimap if $offlineimap; then -- cgit v1.2.3-2-g168b