From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EVoK7-0008Ps-El for garchives@archives.gentoo.org; Sat, 29 Oct 2005 10:52:31 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j9TApsnM009925; Sat, 29 Oct 2005 10:51:54 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j9TAprM2021565 for ; Sat, 29 Oct 2005 10:51:53 GMT Received: from zh034158.ppp.dion.ne.jp ([222.3.34.158] helo=opteron246.suzuki-stubbs.home) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1EVoJU-0005lM-So for gentoo-portage-dev@lists.gentoo.org; Sat, 29 Oct 2005 10:51:53 +0000 Received: by opteron246.suzuki-stubbs.home (Postfix, from userid 1000) id 912BB248ADB; Sat, 29 Oct 2005 19:52:57 +0900 (JST) From: Jason Stubbs To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [4/7] portage_exec cleanups Date: Sat, 29 Oct 2005 19:52:57 +0900 User-Agent: KMail/1.8.92 References: <200510231545.16596.jstubbs@gentoo.org> <200510291934.13207.jstubbs@gentoo.org> In-Reply-To: <200510291934.13207.jstubbs@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_JS1YDsoctwIKave" Message-Id: <200510291952.57471.jstubbs@gentoo.org> X-Archives-Salt: 8980d99a-414e-4984-9256-bfcaab9ef621 X-Archives-Hash: 4c92460482fabcf3457c7498a7887727 --Boundary-00=_JS1YDsoctwIKave Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Remove the exit status check from the logging's setup code and allow it to be handled by the final process monitoring loop. This adds slight overhead of unnecessarily setting up ebuild when tee is broken but simplifies the code. Closing of the read end of the pipe is also moved to just after tee has been spawned so that it is not incorrectly left open in the ebuild process. --Boundary-00=_JS1YDsoctwIKave Content-Type: text/x-diff; charset="utf-8"; name="04-logging.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="04-logging.patch" --- portage_exec.py.orig 2005-10-29 19:08:32.000000000 +0900 +++ portage_exec.py 2005-10-29 19:11:35.000000000 +0900 @@ -85,14 +85,8 @@ mypid=[] if logfile: pr,pw=os.pipe() - mypid.extend(spawn(('tee','-i','-a',logfile),returnpid=True,fd_pipes={0:pr,1:1,2:2})) - retval=os.waitpid(mypid[-1],os.WNOHANG)[1] - if retval != 0: - # he's dead jim. - if (retval & 0xff)==0: - return (retval >> 8) # exit code - else: - return ((retval & 0xff) << 8) # signal + mypid.extend(spawn(('tee','-i','-a',logfile),returnpid=True,fd_pipes={0:pr,1:fd_pipes[1],2:fd_pipes[2]},fd_unused=[pw])) + os.close(pr) fd_pipes[1]=pw fd_pipes[2]=pw @@ -150,7 +144,6 @@ return # should never get reached if logfile: - os.close(pr) os.close(pw) if returnpid: --Boundary-00=_JS1YDsoctwIKave-- -- gentoo-portage-dev@gentoo.org mailing list