Project

General

Profile

« Previous | Next » 

Revision 8986

lib/util.sh: added to_file (), which auto-removes a command's output file on error (like make's .DELETE_ON_ERROR)

View differences:

lib/util.sh
214 214
top_file="${top_script%.run}"
215 215
top_filename="$(basename "$top_file")"
216 216

  
217
# auto-removes a command's output file on error (like make's .DELETE_ON_ERROR)
218
function to_file () # usage: stdout=... to_file cmd...
219
{ : "${stdout?}"; log_e "$@" >"$stdout" || { rm "$stdout"; rethrow; }; }
220
alias to_file='to_file ' # last space alias-expands next word
221

  
217 222
run_args_cmd () # runs the command line args command
218 223
{
219 224
	test $? -eq 0 || return

Also available in: Unified diff