Project

General

Profile

« Previous | Next » 

Revision 9282

lib/sh/util.sh: set_global_fds(): moved stdlog fd setup to separate setup_log_fd() function, which runs at a much higher log_level (5 instead of 3). because the stdlog fd setup statements themselves are logged to fd 2 (because fd 30 is not yet open), you normally don't want to display these, if you are using fd 2 for errors only and fd 30 for logging.

View differences:

lib/sh/util.sh
340 340

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

  
343
setup_log_fd() # view logging output at verbosity >= 5
344
{
345
	log++; log++; log++; echo_func; log++ 
346
	fd_set_default '30>&2' || true # stdlog
347
	log_fd=30 # stdlog
348
}
349
setup_log_fd
350

  
343 351
set_global_fds()
344 352
# allows commands to access global stdin/stdout/stderr using fd 20/21/22
345 353
# this works even when /dev/tty isn't available
......
349 357
	fd_set_default '20<&0' || true
350 358
	fd_set_default '21>&1' || true
351 359
	fd_set_default '22>&2' || true
352
	fd_set_default '30>&2' || true # stdlog
353 360
}
354 361
set_global_fds
355 362
err_fd=22 # global stderr
356
log_fd=30 # stdlog
357 363

  
358 364
# usage: explicit_errors_only=1 script...
359 365
# show only explicitly-displayed errors (which have been redirected to fd 22)

Also available in: Unified diff