Add a python-based setsid script for use with USERLAND=BSD.
authorZac Medico <zmedico@gentoo.org>
Thu, 30 Jul 2009 22:08:40 +0000 (22:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 30 Jul 2009 22:08:40 +0000 (22:08 -0000)
svn path=/main/trunk/; revision=13863

bin/ebuild.sh
bin/setsid [new file with mode: 0755]

index 794738f165b149212a6b25fd7b8739cc1ae27179..6843331edb5456e2287412406300289722dcaa6c 100755 (executable)
@@ -26,11 +26,14 @@ PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sb
 export PATH
 
 if [[ -z $PORTAGE_SETSID && -n $1 && $1 != depend ]] ; then
+       # If available, use setsid to create a new login session so that we can use
+       # SIGHUP to ensure that no orphaned subprocesses are left running.
        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" "$@"
+       elif [[ -x $PORTAGE_BIN_PATH/setsid ]] ; then
+               export PORTAGE_SETSID=1
+               exec "$PORTAGE_BIN_PATH/setsid" "$PORTAGE_BIN_PATH/ebuild.sh" "$@"
        fi
 fi
 [[ $PORTAGE_SETSID = 1 ]] && trap 'trap : SIGHUP ; kill -s SIGHUP 0 ;' EXIT
diff --git a/bin/setsid b/bin/setsid
new file mode 100755 (executable)
index 0000000..1be1e55
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/python -O
+# Copyright 2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+import os
+import sys
+
+os.setsid()
+os.execl(sys.argv[1], *sys.argv[1:])