Project

General

Profile

« Previous | Next » 

Revision 13352

bugfix: lib/sh/util.sh: stderr_matches(): support $benign_error properly, by handling exit status logging in this func instead

View differences:

trunk/lib/sh/util.sh
1120 1120
	prep_try
1121 1121
	
1122 1122
	set +o errexit # avoid errexiting since @PIPESTATUS will be used instead
1123
	{ stderr2stdout "$@"|stdout_contains echo_run grep -E "$pattern"; } 41>&1
1123
	{ benign_error=1 stderr2stdout "$@"\
1124
|stdout_contains echo_run grep -E "$pattern"; } 41>&1
1125
		# benign_error: handle exit status logging in this func instead
1124 1126
	local PIPESTATUS_=("${PIPESTATUS[@]}") # save b/c it's reset after each cmd
1125 1127
	echo_vars PIPESTATUS_
1126 1128
	set -o errexit
......
1129 1131
	e="${PIPESTATUS_[0]}"
1130 1132
	local matches="$(errexit "${PIPESTATUS_[1]}"; exit2bool)"
1131 1133
	if test "$matches"; then ignore_e "$ignore_e" #also works w/ ignore_e=''
1132
	elif is_err && test "$benign_error";then benign_error= die_e #was suppressed
1134
	elif is_err && test ! "$benign_error"; then die_e # incorrectly suppressed
1133 1135
	fi
1134 1136
	rethrow_exit #force-exit b/c caller's test of return status disables errexit
1135 1137
	

Also available in: Unified diff