BaseTools/Source/Python/build/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
From: Irene Park <ipark@nvidia.com>
AutoGen manager/workers halt the progress when an error occurs but
doesn't propagate the error code to main and makes main sys.exit(0)
and gets the build system unable to catch the occurrence of an error.
This change informs main with an error when a progress is halted and
helps main sys.exit(1).
Signed-off-by: Irene Park <ipark@nvidia.com>
---
BaseTools/Source/Python/build/build.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index ed3a3b9..1ab1e60 100755
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -880,7 +880,10 @@ class Build():
self.AutoGenMgr.join()
rt = self.AutoGenMgr.Status
- return rt, 0
+ err = 0
+ if not rt:
+ err = UNKNOWN_ERROR
+ return rt, err
except FatalError as e:
return False, e.args[0]
except:
@@ -2724,4 +2727,3 @@ if __name__ == '__main__':
## 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)
-
--
2.7.4
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#60546): https://edk2.groups.io/g/devel/message/60546
Mute This Topic: https://groups.io/mt/74614093/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Irene, This patch looks good. For the subject, I think it's that the build will exit with 1 when the AutoGen error occurred. Would you update the subject to make it more clear? With the subject update, Reivewed-by: Bob Feng<bob.c.feng@intel.com> Thanks, Bob -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Irene Park Sent: Tuesday, June 2, 2020 4:28 AM To: devel@edk2.groups.io Cc: Irene Park <ipark@nvidia.com> Subject: [edk2-devel] [PATCH v2] BaseTools/Python: sys.exit(1) when error occurred From: Irene Park <ipark@nvidia.com> AutoGen manager/workers halt the progress when an error occurs but doesn't propagate the error code to main and makes main sys.exit(0) and gets the build system unable to catch the occurrence of an error. This change informs main with an error when a progress is halted and helps main sys.exit(1). Signed-off-by: Irene Park <ipark@nvidia.com> --- BaseTools/Source/Python/build/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index ed3a3b9..1ab1e60 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -880,7 +880,10 @@ class Build(): self.AutoGenMgr.join() rt = self.AutoGenMgr.Status - return rt, 0 + err = 0 + if not rt: + err = UNKNOWN_ERROR + return rt, err except FatalError as e: return False, e.args[0] except: @@ -2724,4 +2727,3 @@ if __name__ == '__main__': ## 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) - -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60566): https://edk2.groups.io/g/devel/message/60566 Mute This Topic: https://groups.io/mt/74614093/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Appreciated your proposal for the better subject. Will do it. Thanks, Irene -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng Sent: Tuesday, June 2, 2020 5:18 AM To: devel@edk2.groups.io; Irene Park <ipark@nvidia.com> Subject: Re: [edk2-devel] [PATCH v2] BaseTools/Python: sys.exit(1) when error occurred External email: Use caution opening links or attachments Irene, This patch looks good. For the subject, I think it's that the build will exit with 1 when the AutoGen error occurred. Would you update the subject to make it more clear? With the subject update, Reivewed-by: Bob Feng<bob.c.feng@intel.com> Thanks, Bob -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Irene Park Sent: Tuesday, June 2, 2020 4:28 AM To: devel@edk2.groups.io Cc: Irene Park <ipark@nvidia.com> Subject: [edk2-devel] [PATCH v2] BaseTools/Python: sys.exit(1) when error occurred From: Irene Park <ipark@nvidia.com> AutoGen manager/workers halt the progress when an error occurs but doesn't propagate the error code to main and makes main sys.exit(0) and gets the build system unable to catch the occurrence of an error. This change informs main with an error when a progress is halted and helps main sys.exit(1). Signed-off-by: Irene Park <ipark@nvidia.com> --- BaseTools/Source/Python/build/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index ed3a3b9..1ab1e60 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -880,7 +880,10 @@ class Build(): self.AutoGenMgr.join() rt = self.AutoGenMgr.Status - return rt, 0 + err = 0 + if not rt: + err = UNKNOWN_ERROR + return rt, err except FatalError as e: return False, e.args[0] except: @@ -2724,4 +2727,3 @@ if __name__ == '__main__': ## 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) - -- 2.7.4 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60592): https://edk2.groups.io/g/devel/message/60592 Mute This Topic: https://groups.io/mt/74614093/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.