Project

General

Profile

« Previous | Next » 

Revision 9209

lib/sh/util.sh: added disable_logging() and use it instead of `exec 2>/dev/null`

View differences:

lib/sh/util.sh
153 153

  
154 154
### logging
155 155

  
156
disable_logging() { exec 2>/dev/null; }
157

  
156 158
if test "$explicit_errors_only"; then verbosity=0; fi # hide startup logging
157 159

  
158 160
# set verbosity
......
201 203

  
202 204
# usage: (limit_stderr; cmd...) || return
203 205
# `|| return` needed on Mac because of bug where -e doesn't apply to ()
204
function limit_stderr() { if ! (log++; can_log); then exec 2>/dev/null; fi; }
206
function limit_stderr() { if ! (log++; can_log); then disable_logging; fi; }
205 207

  
206 208

  
207 209
### command echoing
......
347 349
# most of the time this has the same effect as `verbosity=0 script...`,
348 350
# which displays everything that isn't explicitly hidden
349 351
# this option should only be used for testing the explicit error displaying
350
if test "$explicit_errors_only"; then exec 2>/dev/null; fi
352
if test "$explicit_errors_only"; then disable_logging; fi
351 353

  
352 354

  
353 355
#### vars

Also available in: Unified diff