AOSC-Archive / autobuild3

AOSC OS package maintenance toolkit (version 3)
https://aosc.io
GNU General Public License v2.0
24 stars 17 forks source link

libbase/ab{die,warn,err,info,...}: Use BASH_SOURCE & BASH_LINENO in err msgs #92

Open Artoria2e5 opened 8 years ago

Artoria2e5 commented 8 years ago

Expected output:

[WARN] foo/bar.sh:233: blah.

Extra points for abdie: backtrace.

Crappy things:

Alternative solutions:

_abdie(){ ...:$errline: }
alias abdie='errline=$LINENO _abdie'

This will result in some by-func-or-by-script addressing. When you get source from FUNCNAME[0], you should look at BASH_SOURCE instead.