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