REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1145

Currently run PatchCheck.py with Python3 will meet
following error:
.....
File "PatchCheck.py", line 554, in run_git
return Result[0].decode('utf-8', 'ignore') if Result[0] and
Result[0].find("fatal")!=0 else None
TypeError: a bytes-like object is required, not 'str'

This issue was introduce by commit:5ac4548cdf654.

This patch is to convert the str object of "fatal" to
byte object to fix this failure.

Cc: Liming Gao <[email protected]>
Cc: Jaben Carsey <[email protected]>
Cc: Yonghong Zhu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
---
 BaseTools/Scripts/PatchCheck.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 96b3cdf1fd..0b580f3b31 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -549,11 +549,11 @@ class CheckGitCommits:
         cmd += args
         p = subprocess.Popen(cmd,
                      stdout=subprocess.PIPE,
                      stderr=subprocess.STDOUT)
         Result = p.communicate()
-        return Result[0].decode('utf-8', 'ignore') if Result[0] and 
Result[0].find("fatal")!=0 else None
+        return Result[0].decode('utf-8', 'ignore') if Result[0] and 
Result[0].find(b"fatal")!=0 else None
 
 class CheckOnePatchFile:
     """Performs a patch check for a single file.
 
     stdin is used when the filename is '-'.
-- 
2.14.3.windows.1

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

Reply via email to