Project

General

Profile

« Previous | Next » 

Revision 9448

lib/sh/util.sh: try(): always run the command with benign_error=1 so that any die_e() doesn't prematurely indicate that a particular exit status was an error

View differences:

util.sh
119 119

  
120 120
# usage: try cmd...; ignore status; if catch status; then ...; fi; end_try
121 121

  
122
function try() { e=0; "$@" || { export_e; true; }; }
122
function try() { e=0; benign_error=1 "$@" || { export_e; true; }; }
123 123
alias try='declare e; "try" ' # last space alias-expands next word
124 124

  
125 125
catch() { test "$e" -eq "$1"; e=0; }

Also available in: Unified diff