From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QUhnZ-0001iF-Hd for garchives@archives.gentoo.org; Thu, 09 Jun 2011 16:09:33 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0F4051C0F3; Thu, 9 Jun 2011 16:09:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D61121C0F3 for ; Thu, 9 Jun 2011 16:09:20 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4857E1B4022 for ; Thu, 9 Jun 2011 16:09:20 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 894148003C for ; Thu, 9 Jun 2011 16:09:19 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <88f5bf84e2fd23125910b2ecaffc035971445696.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/SubProcess.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 88f5bf84e2fd23125910b2ecaffc035971445696 Date: Thu, 9 Jun 2011 16:09:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: ea99b86951a49797c8e54e47a4c5231f commit: 88f5bf84e2fd23125910b2ecaffc035971445696 Author: Zac Medico gentoo org> AuthorDate: Thu Jun 9 16:07:54 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Jun 9 16:07:54 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D88f5bf84 SubProcess: make returncode like Popen --- pym/_emerge/SubProcess.py | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py index 115af80..da2b301 100644 --- a/pym/_emerge/SubProcess.py +++ b/pym/_emerge/SubProcess.py @@ -124,14 +124,18 @@ class SubProcess(AbstractPollTask): self._files =3D None =20 def _set_returncode(self, wait_retval): + """ + Set the returncode in a manner compatible with + subprocess.Popen.returncode: A negative value -N indicates + that the child was terminated by signal N (Unix only). + """ =20 - retval =3D wait_retval[1] + pid, status =3D wait_retval =20 - if retval !=3D os.EX_OK: - if retval & 0xff: - retval =3D (retval & 0xff) << 8 - else: - retval =3D retval >> 8 + if os.WIFSIGNALED(status): + retval =3D - os.WTERMSIG(status) + else: + retval =3D os.WEXITSTATUS(status) =20 self.returncode =3D retval =20