From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9C096139694 for ; Thu, 23 Mar 2017 17:55:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 47F4C21C11D; Thu, 23 Mar 2017 17:55:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F17BCE0C2F for ; Thu, 23 Mar 2017 17:55:48 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 1FB69341646; Thu, 23 Mar 2017 17:55:46 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH] multibuild.eclass: Reap stray subjobs before exiting sub-phase Date: Thu, 23 Mar 2017 18:55:39 +0100 Message-Id: <20170323175539.17716-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.12.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 59741a61-09e4-46e2-a310-5f0d3e618347 X-Archives-Hash: d3b1f3085eeb29433e160f5f3ef7b973 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