Project

General

Profile

« Previous | Next » 

Revision 9690

bugfix: lib/sh/util.sh: to_file(): need to run invoked cmd using redir so that >$stdout redir is applied properly when cmd is a shell function instead of an external command (external commands were already redirected properly because command() calls redir). this fixes a bug in inputs/GBIF/_MySQL/GBIFPortalDB-2013-02-20.data.sql.run ^.preamble.sql/make(), where the generated file would be output to stdout instead of to the file because to_file()'s command was a shell function, and therefore the redirection was not applied. this fix requires redir() to be a separate function from command(), because command() does many things that are only applicable to external commands.

View differences:

lib/sh/util.sh
672 672
	if test "$if_not_exists"; then require_not_exists "$stdout" || return 0; fi
673 673
	
674 674
	local redirs=("${redirs[@]}" ">$stdout")
675
	"$@" || { save_e; test ! "$del" || rm "$stdout"; rethrow; }
675
	redir "$@" || { save_e; test ! "$del" || rm "$stdout"; rethrow; }
676 676
}
677 677
alias to_file='"to_file" ' # last space alias-expands next word
678 678

  

Also available in: Unified diff