Project

General

Profile

« Previous | Next » 

Revision 12198

bugfix: lib/sh/util.sh: stderr_matches(): need to save PIPESTATUS and then use the saved var because it's reset after each cmd

View differences:

trunk/lib/sh/util.sh
711 711
# exit status of cmd is placed in $e for use with exception handling
712 712
{
713 713
	echo_func; kw_params pattern; : "${pattern?}"
714
	local PIPESTATUS_
714 715
	"try" stderr2stdout "$@"|"try" stdout_contains echo_run grep -E "$pattern"
715
	e="${PIPESTATUS[0]}"      # 1st command's exit status -> $e
716
	return "${PIPESTATUS[1]}" # 2nd command's exit status -> $?
716
	PIPESTATUS_=("${PIPESTATUS[@]}") # save because it's reset after each cmd
717
	e="${PIPESTATUS_[0]}"      # 1st command's exit status -> $e
718
	return "${PIPESTATUS_[1]}" # 2nd command's exit status -> $?
717 719
}
718 720
alias stderr_matches='prep_try; "stderr_matches" '
719 721
	# last space alias-expands next word

Also available in: Unified diff