[bitbake-devel] [PATCH] bitbake: use sys.exit to simplify the code

Ed Bartosh ed.bartosh at linux.intel.com
Tue Apr 28 12:52:18 UTC 2015


Used sys.exit instead of assigning exit code to
variable. This way it's more clear when bitbake
exists and which exit code is used.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 bitbake/bin/bitbake | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 88ac8c3..b6f19ef 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -41,16 +41,13 @@ if __name__ == "__main__":
     if __version__ != bb.__version__:
         sys.exit("Bitbake core version and program version mismatch!")
     try:
-        ret = bitbake_main(BitBakeConfigParameters(sys.argv),
-                           cookerdata.CookerConfiguration())
+        sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
+                              cookerdata.CookerConfiguration()))
     except BBMainException as err:
-        print >>sys.stderr, err
-        ret = 1
+        sys.exit(err)
     except bb.BBHandledException:
-        ret = 1
+        sys.exit(1)
     except Exception:
-        ret = 1
         import traceback
         traceback.print_exc()
-    sys.exit(ret)
-
+        sys.exit(1)
-- 
2.1.4




More information about the bitbake-devel mailing list