Revision 9204
Added by Aaron Marcuse-Kubitza about 11 years ago
util.sh | ||
---|---|---|
199 | 199 |
|
200 | 200 |
# usage: (limit_stderr; cmd...) || return |
201 | 201 |
# `|| return` needed on Mac because of bug where -e doesn't apply to () |
202 |
function limit_stderr() |
|
203 |
{ |
|
204 |
log++ # should only apply during this function for use by can_log |
|
205 |
if ! can_log; then exec 2>/dev/null; fi |
|
206 |
} |
|
202 |
function limit_stderr() { if ! (log++; can_log); then exec 2>/dev/null; fi; } |
|
207 | 203 |
|
208 | 204 |
|
209 | 205 |
### command echoing |
Also available in: Unified diff
lib/sh/util.sh: limit_stderr(): inlined log++ with the can_log call because it should only apply to it. this also makes it obvious that log++ should not apply outside of this function. this also enables the contents of this function to be used in an alias.