From b28d406b5a3b1506ce75fa71c74b489b68a2c11a Mon Sep 17 00:00:00 2001 From: "Feng, YunhuaX" Date: Thu, 25 Oct 2018 13:51:01 +0800 Subject: [PATCH] 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 Reviewed-by: Yonghong Zhu --- 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 @@ -153,7 +153,10 @@ def StartBpdg(InputFileName, MapFileName, VpdFileName, Force): EdkLogger.info("- Vpd pcd fixed done! -") if __name__ == '__main__': - r = main() + try: + r = main() + except FatalError as e: + r = e ## 0-127 is a safe return range, and 1 is a standard default error if r < 0 or r > 127: r = 1 sys.exit(r) diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py index 0485bf482e..2fb8e66fe9 100644 --- a/BaseTools/Source/Python/Common/VpdInfoFile.py +++ b/BaseTools/Source/Python/Common/VpdInfoFile.py @@ -254,9 +254,8 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName): PopenObject.wait() if PopenObject.returncode != 0: - if PopenObject.returncode != 0: - EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(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(error)) + EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \ (PopenObject.returncode, str(error))) return PopenObject.returncode