diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-03-23 18:52:12 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-04-14 18:27:52 +0200 |
commit | e5e4a35151f64b423c4201a30270a236dab3bf58 (patch) | |
tree | b764ee1565e81f56ddf9e63451f830a8ef1d57e2 /eclass/multibuild.eclass | |
parent | estack.eclass: Use 'shopt -p -o' to restore 'set' flags (diff) | |
download | gentoo-e5e4a35151f64b423c4201a30270a236dab3bf58.tar.gz gentoo-e5e4a35151f64b423c4201a30270a236dab3bf58.tar.bz2 gentoo-e5e4a35151f64b423c4201a30270a236dab3bf58.zip |
multibuild.eclass: Reap stray subjobs before exiting sub-phase
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.
Diffstat (limited to 'eclass/multibuild.eclass')
-rw-r--r-- | eclass/multibuild.eclass | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass index 0f89e4ec0b83..a29218d8d840 100644 --- a/eclass/multibuild.eclass +++ b/eclass/multibuild.eclass @@ -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} |