...
then the calling script traps this return code and calls ERROR (ecflow_client --abort)
Code Block |
---|
ERROR() { trap 0 ecflow_client --abort=$$ exit 1 } trap ERROR 0 $SIGNAL_LIST # ... function call { trap '{ echo "Error in function"; exit 1; }' 0 $SMS$SIGNAL_SIGNAL_LIST set -ex # ... trap 0; return 0 ##### reset trap } # ... call trap 0; ecflow_client --complete ; exit 0 |
In the next example, exit 1 will directly exit the script, so that we have to call ecflow_client to report the abort to the server.
Code Block |
---|
call() { trap '{ ecflow_client --abort =$$; exit 1; }' 0 $SMS$SIGNAL_SIGNAL_LIST set -ex } |
In a similar way, in 'if' or 'while' expression, [[ ...]] or ((...)) shall be preferred to [...] to get the trapping propagated as expected.