Project

General

Profile

« Previous | Next » 

Revision 9222

lib/sh/util.sh: inlined limit_log_fd into command() since it's only used once

View differences:

util.sh
201 201
die() { save_e; "log_${type:-err}" "$1"; rethrow; }
202 202

  
203 203

  
204
### command verbose output
205

  
206
# usage: (limit_log_fd; cmd...) || return
207
# `|| return` needed on Mac because of bug where -e doesn't apply to ()
208
function limit_log_fd() { if ! (log++; can_log); then disable_logging; fi; }
209

  
210

  
211 204
### command echoing
212 205

  
213 206
alias echo_params='log "$*"'
......
236 229
	cmd2rel_path; (echo_params; can_log) && indent || true
237 230
	(
238 231
		# the following redirections must happen in exactly this order
239
		limit_log_fd
232
		if ! (log++; can_log); then disable_logging; fi
240 233
		if test "$cmd_log_fd"; then echo_eval exec "$cmd_log_fd>&$log_fd"; fi
241 234
		if test "$cmd_log_fd" != 2; then # fd 2 not used for logging
242 235
			exec 2>&"$err_fd" # assume fd 2 used for errors

Also available in: Unified diff