Revision 14731
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
743 | 743 |
|
744 | 744 |
die() # usage: if msg uses $(...): cmd || { save_e; [type=...] die msg; } |
745 | 745 |
# if msg uses only vars: cmd || [type=...] die msg |
746 |
{ save_e; log++ kw_params type; "log_${type:-err}" "$1"; rethrow!; }
|
|
746 |
{ save_e; "log_${type:-err}" "$1"; rethrow!; } |
|
747 | 747 |
|
748 | 748 |
die_e() # usage: cmd || [benign_error=1] die_e [|| handle error] |
749 | 749 |
{ |
... | ... | |
782 | 782 |
|
783 | 783 |
rel_path() # usage: base_dir=... path=... rel_path |
784 | 784 |
{ |
785 |
log_local; log++; kw_params base_dir path
|
|
785 |
log_local; log++; #kw_params base_dir path #off -> no pst infinite recursion
|
|
786 | 786 |
: "${base_dir:?}" "${path:?}" |
787 | 787 |
|
788 | 788 |
local path="$path/" # add *extra* / to match path when exactly = base_dir |
... | ... | |
791 | 791 |
|
792 | 792 |
if test ! "$path"; then path=.; fi # ensure non-empty |
793 | 793 |
|
794 |
echo_vars path
|
|
794 |
#echo_vars path # off -> no pst infinite recursion
|
|
795 | 795 |
echo "$path" |
796 | 796 |
} |
797 | 797 |
|
... | ... | |
801 | 801 |
canon_rel_path() # usage: [base_dir=...] canon_rel_path path |
802 | 802 |
# falls back to original path if can't resolve |
803 | 803 |
{ |
804 |
kw_params base_dir; local path="$1" base_dir="${base_dir-$PWD}" |
|
804 |
#kw_params base_dir # off -> no pst infinite recursion |
|
805 |
local path="$1" base_dir="${base_dir-$PWD}" |
|
805 | 806 |
canon_rel_path__try || echo "$path" |
806 | 807 |
} |
807 | 808 |
canon_rel_path__try() |
Also available in: Unified diff
bugfix: lib/sh/util.sh: functions called by pst(): commented out/removed logging calls that would have caused infinite recursion when pst()'ing a logging function