Project

General

Profile

« Previous | Next » 

Revision 9261

lib/sh/util.sh: set_fd(): allow setting multiple fds at once, and changed the function name accordingly

View differences:

lib/sh/util.sh
394 394
require_fd_not_exists() # usage: require_fd_not_exists fd || return 0
395 395
{ ! fd_exists "$1" || type=info die "fd $1 already exists, skipping"; }
396 396

  
397
set_fd() { echo_func; echo_eval exec "$1"; } # usage: set_fd 'dest[<>]src'
397
set_fds() { echo_func; echo_eval exec "$@"; } # usage: set_fds redirect...
398 398

  
399 399
fd_set_default() # usage: fd_set_default 'dest[<>]src'
400 400
{
401 401
	echo_func
402 402
	local dest="${1%%[<>]*}"
403 403
	require_fd_not_exists "$dest" || return 0
404
	set_fd "$1"
404
	set_fds "$1"
405 405
}
406 406

  
407 407
# convention: use fd 10/11/12 for command-specific alternate stdin/stdout/stderr

Also available in: Unified diff