summaryrefslogtreecommitdiffstats
path: root/bin/isolated-functions.sh
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-06 20:48:05 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-06 20:48:05 +0000
commitd8d45379b52f5330c6cec616d675706eb0ba2599 (patch)
tree9ca611588d1df0a68fe93313ac6b3782698a40b7 /bin/isolated-functions.sh
parent2eab6930cc67c631b679b55f0b588e4f625ebb19 (diff)
downloadportage-d8d45379b52f5330c6cec616d675706eb0ba2599.tar.gz
portage-d8d45379b52f5330c6cec616d675706eb0ba2599.tar.bz2
portage-d8d45379b52f5330c6cec616d675706eb0ba2599.zip
Implement nonfatal().
svn path=/main/trunk/; revision=13936
Diffstat (limited to 'bin/isolated-functions.sh')
-rwxr-xr-xbin/isolated-functions.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index a05cffed0..2bd704d72 100755
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -53,7 +53,23 @@ dump_trace() {
done
}
+nonfatal() {
+ if has "${EAPI:-0}" 0 1 2; then
+ die "$FUNCNAME() not supported in this EAPI"
+ fi
+ if [[ $# -lt 1 ]]; then
+ die "$FUNCNAME(): Missing argument"
+ fi
+
+ PORTAGE_NONFATAL=1 "$@"
+}
+
die() {
+ if [[ $PORTAGE_NONFATAL -eq 1 ]]; then
+ echo -e " $WARN*$NORMAL ${FUNCNAME[1]}: WARNING: $@" >&2
+ return 1
+ fi
+
set +e
if [ -n "${QA_INTERCEPTORS}" ] ; then
# die was called from inside inherit. We need to clean up