Skip to content

Commit

Permalink
multibuild.eclass: Reap stray subjobs before exiting sub-phase
Browse files Browse the repository at this point in the history
Alike the PMS-defined phases, sub-phases do not support leaving jobs
behind. To avoid leaving something accidentally, make sure to reap all
jobs (i.e. wait) post running the command. Warn if any stray processes
are found since that indicates a bug in ebuild.
  • Loading branch information
mgorny committed Apr 14, 2017
1 parent 16c504f commit e5e4a35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eclass/multibuild.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ multibuild_foreach_variant() {
_multibuild_run "${@}" \
> >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
lret=${?}

# make sure no processes are left over
local leftovers=
while :; do
wait -n
[[ ${?} -eq 127 ]] && break || leftovers=1
done

if [[ ${leftovers} ]]; then
ewarn "The multibuild function has left one or more processes running"
ewarn "in the background. Please report a bug."
fi
done
[[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}

Expand Down

0 comments on commit e5e4a35

Please sign in to comment.