From 4dc82da0e9be7daaaaae34bb3ba9f25a3355cf6c Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sun, 5 Jan 2020 09:10:14 -0800 Subject: [PATCH] Make lxbuildenv.py return 0 on success. `sys.exit` raises a `SystemExit` exception which causes a bare except to always trigger. IE the below always prints hello. ```python import sys try: sys.exit(0) except: print("Hello") ``` However, SystemExit doesn't inherit from Exception, so the following works as expected. ```python import sys try: sys.exit(0) except Exception: print("Hello") ``` --- litex/lxbuildenv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/litex/lxbuildenv.py b/litex/lxbuildenv.py index dd155b8..bfcb2e6 100644 --- a/litex/lxbuildenv.py +++ b/litex/lxbuildenv.py @@ -592,7 +592,8 @@ elif "LXBUILDENV_REEXEC" not in os.environ: try: sys.exit(subprocess.Popen( [sys.executable] + [sys.argv[0]] + rest).wait()) - except: + except Exception as e: + print(e) sys.exit(1) else: # Overwrite the deps directory.