Revision 12197
Added by Aaron Marcuse-Kubitza about 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
707 | 707 |
stdout_contains() # usage: stderr2stdout cmd|stdout_contains echo_run grep ... |
708 | 708 |
{ echo_func; pipe_delay; pipe_delay; "$@"|echo_stdout >/dev/null; } |
709 | 709 |
|
710 |
stderr_matches() # usage: if pattern=... stderr_matches cmd...; then ... |
|
710 |
function stderr_matches() # usage: if pattern=... stderr_matches cmd...; then... |
|
711 |
# exit status of cmd is placed in $e for use with exception handling |
|
711 | 712 |
{ |
712 | 713 |
echo_func; kw_params pattern; : "${pattern?}" |
713 |
stderr2stdout "$@"|stdout_contains echo_run grep -E "$pattern" |
|
714 |
"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 -> $? |
|
714 | 717 |
} |
718 |
alias stderr_matches='prep_try; "stderr_matches" ' |
|
719 |
# last space alias-expands next word |
|
715 | 720 |
|
716 | 721 |
function ignore_err_msg() # usage: pattern=... ignore_err_msg cmd... |
717 | 722 |
{ |
Also available in: Unified diff
lib/sh/util.sh: stderr_matches(): place exit status of cmd in $e for use with exception handling