Mercurial > repos > mikel-egana-aranguren > sadi_generic
comparison galaxy-dist/tool-data/shared/errwrap.sh @ 2:977c838e3442 draft default tip
New dir structure, README improved, tests added and RDF merge tool created
author | mikel-egana-aranguren <mikel.egana.aranguren@gmail.com> |
---|---|
date | Fri, 25 Apr 2014 14:41:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:bb17b69a74c5 | 2:977c838e3442 |
---|---|
1 #!/bin/bash | |
2 | |
3 # Script for gracefully handling errors in galaxy, copied from | |
4 # https://bitbucket.org/cmungall/galaxy-obo | |
5 | |
6 # Some programs send normal info to STDERR, making galaxy think an error has | |
7 # ocurred. This script, developed by Chris Mungall, fixes the problem by capturing | |
8 # the error and only sending it to STDERR if it is really an error, by lloking at | |
9 # the program's exit code | |
10 | |
11 # Temporary storage for STDERR | |
12 TMP_STDERR="/tmp/errwrap-$$.tmp" || exit 1 | |
13 | |
14 # Run the program, send STDERR to temporary file | |
15 "$@" 2> $TMP_STDERR | |
16 | |
17 #check program's exit code | |
18 if (( $? )); then | |
19 #Program failed, send STDERR to real STDERR | |
20 cat $TMP_STDERR >&2 | |
21 rm $TMP_STDERR | |
22 exit 1 | |
23 fi | |
24 | |
25 #Program succeeded, delete STDERR file | |
26 rm $TMP_STDERR | |
27 exit 0 |