summaryrefslogtreecommitdiff
path: root/onerror
diff options
context:
space:
mode:
Diffstat (limited to 'onerror')
-rwxr-xr-xonerror12
1 files changed, 12 insertions, 0 deletions
diff --git a/onerror b/onerror
new file mode 100755
index 0000000..3e5a927
--- /dev/null
+++ b/onerror
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+temp=$(mktemp)
+"$@" > "$temp" 2>&1
+ret=$?
+if [ $ret != 0 ]
+then
+ cat "$temp" 1>&2
+fi
+rm -f "$temp"
+exit $ret
+