Revision 12689
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
720 | 720 |
# usage: { stderr2stdout cmd|stdout_contains echo_run grep ...; } 41>&1 |
721 | 721 |
{ echo_func; pipe_delay; pipe_delay; "$@"|echo_stdout >/dev/null; } |
722 | 722 |
|
723 |
function stderr_matches() # usage: if pattern=... stderr_matches cmd...; \
|
|
724 |
# then ...; fi; rethrow # manually rethrow any command error (if applicable)
|
|
723 |
function stderr_matches() # usage: prep_try; if pattern=... "stderr_matches" \
|
|
724 |
# cmd...; then ...; fi; rethrow # manually rethrow any cmd error (if applicable)
|
|
725 | 725 |
# exit status of cmd is placed in $e for use with exception handling |
726 | 726 |
{ |
727 | 727 |
echo_func; kw_params pattern; : "${pattern?}" |
trunk/lib/sh/db.sh | ||
---|---|---|
361 | 361 |
pg_schema_exists() # usage: schema=... pg_schema_exists |
362 | 362 |
{ |
363 | 363 |
echo_func; : "${schema:?}"; mk_schema_esc |
364 |
pattern='cannot create temporary relation in non-temporary schema' \ |
|
365 |
stderr_matches psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
|
|
364 |
prep_try; pattern='cannot create temporary relation in non-temporary schema' \
|
|
365 |
"stderr_matches" psql <<<"CREATE TEMP TABLE $schema_esc.t ()"
|
|
366 | 366 |
} |
367 | 367 |
|
368 | 368 |
pg_require_schema() # usage: schema=... pg_require_schema |
Also available in: Unified diff
bugfix: lib/sh/util.sh: stderr_matches(): when passing `pattern=...` as a prefix env var, must be invoked as `"stderr_matches"` to avoid the env var applying to the prep_try portion of the stderr_matches alias