Reviewed-by: Yonghong Zhu <[email protected]> 

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Feng, YunhuaX 
Sent: Thursday, October 25, 2018 1:51 PM
To: [email protected]
Cc: Zhu, Yonghong <[email protected]>; Gao, Liming <[email protected]>
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 <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <[email protected]>
---
 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)
 
     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
@@ -252,11 +252,10 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
     print(out)
     while PopenObject.returncode is None :
         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
--
2.12.2.windows.2

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to