Revision 12736
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/db.sh | ||
---|---|---|
274 | 274 |
# "Permission denied" error when running as sudo on Linux |
275 | 275 |
{ |
276 | 276 |
echo_func; kw_params stdin |
277 |
local verbose_="$(! isset SUDO_USER; exit2bool)"; echo_vars verbose_
|
|
277 |
local verbose_ok="$(! isset SUDO_USER; exit2bool)"; echo_vars verbose_ok
|
|
278 | 278 |
|
279 |
if test "$verbose_" && can_log; then set -- --echo-all --echo-hidden "$@";fi |
|
279 |
if test "$verbose_ok" && can_log; then set -- --echo-all --echo-hidden "$@";fi
|
|
280 | 280 |
local redirs=("${redirs[@]}" '40<&0' "0<${stdin:-&20}" '41>&1') |
281 | 281 |
( |
282 | 282 |
# hide stack traces/DETAIL sections of error messages at verbosity <2 |
283 | 283 |
if ! clog++ can_log; then echo '\set VERBOSITY terse'; fi |
284 |
if test "$verbose_" && can_log; then cat <<'EOF' |
|
284 |
if test "$verbose_ok" && can_log; then cat <<'EOF'
|
|
285 | 285 |
\timing on |
286 | 286 |
SET client_min_messages = NOTICE; |
287 | 287 |
EOF |
288 | 288 |
fi |
289 | 289 |
cat |
290 |
)|cmd_log_fd=${verbose_:+1} pg_cmd --file /dev/fd/40 \ |
|
291 |
${verbose_:+--output /dev/fd/41 }--set ON_ERROR_STOP=1 --quiet "$@" \ |
|
290 |
)|cmd_log_fd=${verbose_ok:+1} pg_cmd --file /dev/fd/40 \
|
|
291 |
${verbose_ok:+--output /dev/fd/41 }--set ON_ERROR_STOP=1 --quiet "$@" \
|
|
292 | 292 |
|| verbosity_min=2 die_error_hidden |
293 | 293 |
# --output is for query *results*, not echoed statements |
294 | 294 |
} |
Also available in: Unified diff
fix: lib/sh/db.sh: psql(): $verbose_: renamed to $verbose_ok for clarity