summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-11-02 22:57:04 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-11-02 22:57:04 -0400
commitd251e782d9fe66d64035fcc4db92dc1c98ad3190 (patch)
treea3e2b54994a701ae09097143aeca0e2726b7dd9f
parent32ffdd46b945e2cad9c0d17ae40feffc6fdb4733 (diff)
add offlineimap-exit: it returns a non-zero exit status for errors
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--offlineimap-exit.sh11
-rw-r--r--offlineimap-runner.sh2
4 files changed, 14 insertions, 1 deletions
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