summaryrefslogtreecommitdiffstats
path: root/bin/ebuild.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ebuild.sh')
-rwxr-xr-xbin/ebuild.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index a20f8d4c9..bd32f85ff 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -71,6 +71,17 @@ PREROOTPATH=${PREROOTPATH%%:}
PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH
export PATH
+if [[ -z $PORTAGE_SETSID && \
+ -n $EBUILD_SH_ARGS && $EBUILD_SH_ARGS != depend ]] ; then
+ if type -P setsid >/dev/null ; then
+ # Use setsid to create a new login session so that we can use SIGHUP
+ # to ensure that no orphaned subprocesses are left running.
+ export PORTAGE_SETSID=1
+ exec setsid "$PORTAGE_BIN_PATH/ebuild.sh" $EBUILD_SH_ARGS
+ fi
+fi
+trap '[[ $PORTAGE_SETSID = 1 ]] && { trap : SIGHUP ; kill -s SIGHUP 0 ; }' EXIT
+
source "${PORTAGE_BIN_PATH}/isolated-functions.sh" &>/dev/null
# Set IMAGE for minimal backward compatibility with