From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 7B76B2117FD67 for ; Wed, 24 Oct 2018 22:51:05 -0700 (PDT) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2018 22:51:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,423,1534834800"; d="dat'59?scan'59,208,59";a="274272209" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 24 Oct 2018 22:51:04 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 22:51:04 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 22:51:03 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.102]) with mapi id 14.03.0415.000; Thu, 25 Oct 2018 13:51:01 +0800 From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Gao, Liming" Thread-Topic: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue Thread-Index: AdRsJrTpJixuslFjTSqqud+Jpt9VAA== Date: Thu, 25 Oct 2018 05:51:01 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC49063F7@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC49063F7@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [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: Thu, 25 Oct 2018 05:51:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 to e= xecute BPDG tool with exit code: %d, the error message is: \n %s" % \ (PopenObject.returncode, str(error))) =20 return PopenObject.returncode --=20 2.12.2.windows.2