Created
March 18, 2014 11:37
-
-
Save mikel-egana-aranguren/9618378 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://bitbucket.org/cmungall/galaxy-obo/src/e29c68304c23628cb474bf4ac5f778c31a456850/tools/shared/errwrap.sh?at=default | |
#!/bin/bash | |
# Temporary storage for STDERR | |
TMP_STDERR="/tmp/errwrap-$$.tmp" || exit 1 | |
# Run the program, send STDERR to temporary file | |
"$@" 2> $TMP_STDERR | |
#check program's exit code | |
if (( $? )); then | |
#Program failed, send STDERR to real STDERR | |
cat $TMP_STDERR >&2 | |
rm $TMP_STDERR | |
exit 1 | |
fi | |
#Program succeeded, delete STDERR file | |
rm $TMP_STDERR | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment