From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web12.46953.1591043311471194623 for ; Mon, 01 Jun 2020 13:28:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=d6Gs1e7R; spf=pass (domain: nvidia.com, ip: 216.228.121.64, mailfrom: ipark@nvidia.com) Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 01 Jun 2020 13:27:04 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 01 Jun 2020 13:28:31 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 01 Jun 2020 13:28:31 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 1 Jun 2020 20:28:30 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 1 Jun 2020 20:28:30 +0000 Received: from ipark-ubuntu.nvidia.com (Not Verified[10.28.100.106]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 01 Jun 2020 13:28:30 -0700 From: "Irene Park" To: CC: Irene Park Subject: [PATCH v2] BaseTools/Python: sys.exit(1) when error occurred Date: Mon, 1 Jun 2020 16:28:25 -0400 Message-ID: <461959c91617bf66a6a3e23c03dc80e62202302d.1591043186.git.ipark@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public Return-Path: ipark@nvidia.com MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1591043224; bh=FQ2HdOZhE+YayjJyp3fztRxshiFlgY8QdiFYk3mRYyE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=d6Gs1e7RHmmIQc9XGnZNMc8A7H4Z8RvHhgb6jsNKSM3tDp+UOovCc/xwAF8U2tIsj hFwfCYskCoRasIDQszhLdt5ruzzUeYkJwUGOKq3EeVlWGYtLQqDHotFRW88cD2dUMH TvYhfyH0cxGg1jIHJVORjqR5y7WQm4xzPeeycqV0sFkfdwAIi4/vfFRVQQy1sJwXJJ IVyOMGfXZvMCExPcfsxwSfzBDEhvIJCR+VObrjeyYF2Aa97PcqQY1rhfrsebFpPjMD /+hZ/qJPUOKQ3U25A0CEgYD94aQ9MjXuBKL7ml9x0q6B9yUEJN2Fa6V83RzEueMeBV 9v7w6kesyHdNg== Content-Type: text/plain From: Irene Park 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 --- 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