Project

General

Profile

« Previous | Next » 

Revision 9477

lib/sh/local.sh: use @redirs instead of manual redirection to set up --output fd, so that the redirection will be echoed along with the command. for some reason, this requires switching to fd 13 instead of 11, because fd 11 gives a "/dev/fd/11: Bad file descriptor" error when 11 is set with exec right before the command instead of on the subshell the command is executed in. (13 was chosen rather than 12 because 2 is for errors, while *3 (or 3) is for logging.)

View differences:

lib/sh/local.sh
46 46
	mk_table_esc
47 47
	
48 48
	local psql_cmd="psql_$(if can_log; then echo verbose; else echo script; fi)_vegbien"
49
	local redirs=("${redirs[@]}" '13>&1')
49 50
	(cat <<EOF
50 51
\cd $dir
51 52
\set schema $schema_esc
......
54 55
SET search_path TO $schema_esc, util;
55 56
EOF
56 57
	cat)|cmd_log_fd=1 \
57
	env no_search_path=1 "$psql_cmd" --output /dev/fd/11 "$@" 11>&1
58
	env no_search_path=1 "$psql_cmd" --output /dev/fd/13 "$@"
58 59
}
59 60

  
60 61
public_schema_exists() { psql_script_vegbien </dev/null 2>/dev/null; }

Also available in: Unified diff