#68: GetComponents hang due to certificate issues. ---------------------------------+------------------------------------------ Reporter: diener@… | Owner: eric9 Type: defect | Status: reopened Priority: major | Milestone: ET_2012_11 Component: GetComponents | Version: ET_2011_10 Resolution: | Keywords: ---------------------------------+------------------------------------------
Comment (by knarf):
We cannot rely on bash being the shell. What about the following, taken from
http://www.unix.com/shell-programming-scripting/92163-command-does-not- return-exit-status-due-tee.html
{{{ You can use this function to make it easier:
run() { j=1 while eval "${pipestatus_$j+:} false"; do unset pipestatus_$j j=$(($j+1)) done j=1 com= k=1 l= for a; do if [ "x$a" = 'x|' ]; then com="$com { $l "'3>&- echo "pipestatus_'$j'=$?" >&3 } 4>&- |' j=$(($j+1)) l= else l="$l "$$k"" fi k=$(($k+1)) done com="$com $l"' 3>&- >&4 4>&- echo "pipestatus_'$j'=$?"' exec 4>&1 eval "$(exec 3>&1; eval "$com")" exec 4>&- j=1 while eval "${pipestatus_$j+:} false"; do eval "[ $pipestatus_$j -eq 0 ]" || return 1 j=$(($j+1)) done return 0 }
use it as:
run cmd1 | cmd2 | cmd3 exit codes are in $pipestatus_1, $pipestatus_2, $pipestatus_3 }}}