Another simple way to respect exit codes, if you don't care that all stderr produced by a program gets redirected to stdout, is to do something like: <command>executable '$output_file' '$input_file' 2>&1 || echo "Error running executable." >&2</command> On Apr 21, 2010, at 2:10 PM, Assaf Gordon wrote:
Nate Coraor wrote, On 04/21/2010 01:58 PM:
Ry4an Brase wrote:
would change to
R --vanilla --slave $* < $infile 2>&1
While this would indeed fix the problem of the job failing, it'd prevent any failures from ever being detected. What we've done for tools that don't set a return code is attempt to parse the output for errors.
We use shell code similar to the following to temporarily store STDERR, and report it back to Galaxy based on the program's exit code: ======= #!/bin/sh
# Temporary storage for STDERR TMP_STDERR=$(mktemp) || exit 1
# Run the program, send STDERR to temporary file MY_PROGRAM 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
========
-gordon _______________________________________________ galaxy-dev mailing list galaxy-dev@lists.bx.psu.edu http://lists.bx.psu.edu/listinfo/galaxy-dev