From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DA5712117D271 for ; Thu, 25 Oct 2018 19:37:32 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2018 19:37:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,426,1534834800"; d="scan'208";a="84253531" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 25 Oct 2018 19:37:32 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 19:37:31 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 25 Oct 2018 19:37:31 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Fri, 26 Oct 2018 10:37:29 +0800 From: "Zhu, Yonghong" To: "Feng, YunhuaX" , "edk2-devel@lists.01.org" CC: "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue Thread-Index: AdRsJrTpJixuslFjTSqqud+Jpt9VAAArhD/w Date: Fri, 26 Oct 2018 02:37:28 +0000 Message-ID: References: <47C64442C08CCD4089DC43B6B5E46BC49063F7@shsmsx102.ccr.corp.intel.com> In-Reply-To: <47C64442C08CCD4089DC43B6B5E46BC49063F7@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 02:37:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Yonghong Zhu =20 Best Regards, Zhu Yonghong -----Original Message----- From: Feng, YunhuaX=20 Sent: Thursday, October 25, 2018 1:51 PM To: edk2-devel@lists.01.org Cc: Zhu, Yonghong ; Gao, Liming Subject: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue Fix BPDG tool print traceback info issue and remove abundant code Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/BPDG/BPDG.py | 5 ++++- BaseTools/Source/Python/Common/VpdInfoFile.py | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/BPDG/BPDG.py b/BaseTools/Source/Python= /BPDG/BPDG.py index 2ec1516c0a..c30e062a69 100644 --- a/BaseTools/Source/Python/BPDG/BPDG.py +++ b/BaseTools/Source/Python/BPDG/BPDG.py @@ -151,11 +151,14 @@ def StartBpdg(InputFileName, MapFileName, VpdFileName= , Force): GenVPD.GenerateVpdFile(MapFileName, VpdFileName) =20 EdkLogger.info("- Vpd pcd fixed done! -") =20 if __name__ =3D=3D '__main__': - r =3D main() + try: + r =3D main() + except FatalError as e: + r =3D e ## 0-127 is a safe return range, and 1 is a standard default error if r < 0 or r > 127: r =3D 1 sys.exit(r) =20 =20 diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Sour= ce/Python/Common/VpdInfoFile.py index 0485bf482e..2fb8e66fe9 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -252,11 +252,10 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): print(out) while PopenObject.returncode is None : PopenObject.wait() =20 if PopenObject.returncode !=3D 0: - if PopenObject.returncode !=3D 0: - EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", s= tr(error)) - EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail = to execute BPDG tool with exit code: %d, the error message is: \n %s" % \ + EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(e= rror)) + EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail=20 + to execute BPDG tool with exit code: %d, the error message is: \n %s"=20 + % \ (PopenObject.returncode, str(error))) =20 return PopenObject.returncode -- 2.12.2.windows.2