Revision 13280
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/db.sh | ||
---|---|---|
291 | 291 |
# "Permission denied" error when running as sudo on Linux |
292 | 292 |
{ |
293 | 293 |
echo_func; kw_params stdin output_data |
294 |
local bypass_ok="$(! isset SUDO_USER; exit2bool)"; echo_vars bypass_ok
|
|
295 |
local verbose_="$(test "$bypass_ok" && can_log; exit2bool)"
|
|
294 |
local can_redir="$(! isset SUDO_USER; exit2bool)"; echo_vars can_redir
|
|
295 |
local verbose_="$(test "$can_redir" && can_log; exit2bool)"
|
|
296 | 296 |
echo_vars verbose_ |
297 |
local data_bypasses_filter="$(test "$output_data" -a "$bypass_ok";
|
|
297 |
local data_bypasses_filter="$(test "$output_data" -a "$can_redir";
|
|
298 | 298 |
exit2bool)"; echo_vars data_bypasses_filter |
299 | 299 |
|
300 | 300 |
if test "$verbose_"; then set -- --echo-all --echo-hidden "$@"; fi |
... | ... | |
306 | 306 |
echo "SET client_min_messages = \ |
307 | 307 |
$(if test "$verbose_"; then echo NOTICE; else echo WARNING; fi);" |
308 | 308 |
cat |
309 |
)|cmd_log_fd=${bypass_ok:+1} pg_cmd --file /dev/fd/40 \
|
|
309 |
)|cmd_log_fd=${can_redir:+1} pg_cmd --file /dev/fd/40 \
|
|
310 | 310 |
${data_bypasses_filter:+--output /dev/fd/41 }--set ON_ERROR_STOP=1 --quiet "$@"\ |
311 | 311 |
|| verbosity_min=2 die_error_hidden |
312 | 312 |
# --output is for query *results*, not echoed statements |
Also available in: Unified diff
lib/sh/db.sh: psql(): $bypass_ok: renamed to $can_redir for clarity