public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase
Date: Thu, 23 Mar 2017 18:55:39 +0100	[thread overview]
Message-ID: <20170323175539.17716-1-mgorny@gentoo.org> (raw)

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.
---
 eclass/multibuild.eclass | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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}
 
-- 
2.12.1



             reply	other threads:[~2017-03-23 17:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-23 17:55 Michał Górny [this message]
2017-04-14 16:31 ` [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170323175539.17716-1-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox