Project

General

Profile

« Previous | Next » 

Revision 12760

bugfix: lib/sh/util.sh: stderr_matches(): can't use `try` because this clears the exit status, which is needed for @PIPESTATUS to work. to support this, also need to avoid errexiting since @PIPESTATUS will be used instead.

View differences:

trunk/lib/sh/util.sh
784 784
# exit status of cmd is placed in $e for use with exception handling
785 785
{
786 786
	echo_func; kw_params pattern; : "${pattern?}"
787
	{ "try" stderr2stdout "$@"|"try" stdout_contains echo_run grep -E "$pattern"
788
	} 41>&1
787
	
788
	set +o errexit # avoid errexiting since @PIPESTATUS will be used instead
789
	{ stderr2stdout "$@"|stdout_contains echo_run grep -E "$pattern"; } 41>&1
789 790
	local PIPESTATUS_=("${PIPESTATUS[@]}") # save b/c it's reset after each cmd
791
	set -o errexit
792
	
790 793
	e="${PIPESTATUS_[0]}"      # 1st command's exit status -> $e
791 794
	return "${PIPESTATUS_[1]}" # 2nd command's exit status -> $?
792 795
}

Also available in: Unified diff