Project

General

Profile

« Previous | Next » 

Revision 13214

lib/sh/util.sh: ignore_e(): also set benign_error=1

View differences:

trunk/lib/sh/util.sh
250 250

  
251 251
# usage: try cmd...; ignore_e status; if catch status; then ...; fi; end_try
252 252

  
253
alias prep_try='declare e=0'
253
alias prep_try='declare e=0 benign_error="$benign_error"'
254 254

  
255 255
# usage: ...; try cmd... # *MUST* be at beginning of statement
256 256
#     OR prep_try; wrapper "try" cmd...
......
259 259

  
260 260
catch() { test "$e" = "${1:-0}" && e=0; } # also works w/ $1=''
261 261

  
262
ignore_e() { catch "$@" || true; } # also works w/ $1=''
262
ignore_e() { if catch "$@"; then benign_error=1; fi; } # also works w/ $1=''
263 263

  
264 264
alias end_try='rethrow'
265 265

  

Also available in: Unified diff