summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-27 13:31:56 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-27 13:31:56 +0000
commitc5181015ce248383917492246d971d7a389f0772 (patch)
tree78b2df02324c88f17349d123ca374c0d6ad7f2aa
parent9b8f893ceeb765b77011b41113d8e6bb2c9192e6 (diff)
downloadportage-c5181015ce248383917492246d971d7a389f0772.tar.gz
portage-c5181015ce248383917492246d971d7a389f0772.tar.bz2
portage-c5181015ce248383917492246d971d7a389f0772.zip
Add support to elog_base() to split messages on newlines automatically.
Thanks to Arfrever for the suggestion. svn path=/main/trunk/; revision=11218
-rwxr-xr-xbin/isolated-functions.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 6faa5d656..4de6f8503 100755
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -158,7 +158,7 @@ vecho() {
# Internal logging function, don't use this in ebuilds
elog_base() {
- local messagetype
+ local line messagetype
[ -z "${1}" -o -z "${T}" -o ! -d "${T}/logging" ] && return 1
case "${1}" in
INFO|WARN|ERROR|LOG|QA)
@@ -170,7 +170,13 @@ elog_base() {
return 1
;;
esac
- echo -ne "${messagetype} $*\n\0" >> "${T}/logging/${EBUILD_PHASE:-other}"
+ save_IFS
+ IFS=$'\n'
+ for line in $* ; do
+ echo -ne "${messagetype} ${line}\n\0" >> \
+ "${T}/logging/${EBUILD_PHASE:-other}"
+ done
+ restore_IFS
return 0
}