Skip to content

Commit

Permalink
Launch builds in separate contracts so that interrupting a build
Browse files Browse the repository at this point in the history
causes all child processes to be reaped.
Improve cleanup of background tail/egrep pair.
  • Loading branch information
citrus-it committed Oct 17, 2017
1 parent ad7c579 commit 683c659
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions bin/omni
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,24 @@ build_illumos()
typeset env="${1:-${illumos_env}}"
typeset benv=`basename $env`
banner "Starting illumos-omnios $release build... ($benv)"
/opt/onbld/bin/nightly $env &
ctrun -l child -o noorphan /opt/onbld/bin/nightly $env &
nightlypid=$!
[ -f $illumos_clone/log/nightly.log ] && \
rm -f $illumos_clone/log/nightly.log
while [ ! -f $illumos_clone/log/nightly.log ]; do
sleep 1
done
(
tail -f $illumos_clone/log/nightly.log \
| egrep '^(====|real|user|sys)'
| egrep '^(====|real |user |sys )'
) &
tailpid=$!
trap "kill -9 $nightlypid $tailpid" INT
wait $nightlypid
kill $tailpid
trap - INT
pkill -9 -P $tailpid
sleep 5
kill -9 $tailpid
sleep 5
}

Expand All @@ -345,7 +351,7 @@ build_omnios()
(
cd $omnios_clone/build
[ -z "$USER" -a -n "$LOGNAME" ] && USER="$LOGNAME"
./buildctl build $arg
ctrun -l child -o noorphan ./buildctl build $arg
)
}

Expand Down

0 comments on commit 683c659

Please sign in to comment.