webbuild-sudo: fix getting job pid in background mode

This commit is contained in:
Silvan Calarco 2014-02-01 14:55:11 +01:00
parent 14d27be655
commit aee7f737b1

View File

@ -127,11 +127,15 @@ cmdtmpfile=`mktemp --tmpdir=$WEBBUILD_STATEDIR/tmp --suffix=.webbuildcmd`
if [ "$MODE" = "background" ]; then
if [ "$WORKINGHOME" ]; then
[ "$DEBUG" ] && echo "=> . /etc/profile;cd $WORKINGHOME/RPM/SPECS;$SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | tr -d '\f' > $cmdtmpfile &
# WARNING: don't add pipes after $COMMAND or command pid will be wrong
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;stdbuf -o L $COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 > $cmdtmpfile &
# | tr -d '\f'
#sed "s|<|\&lt;|g" |
else
[ "$DEBUG" ] && echo "=> $SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX "$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' > $cmdtmpfile &
# WARNING: don't add pipes after $COMMAND or command pid will be wrong
$SUCMDPREFIX "$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 > $cmdtmpfile &
# | sed "s|<|\&lt;|g" | tr -d '\f'
fi
echo "$! $USER $ENVIRONMENT $PACKAGE $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
echo "Started background command: $COMMAND"