From f84563ff9dd3d2654830b2c97fdd6cadc25fbb1d Mon Sep 17 00:00:00 2001 From: Frederik Pfautsch Date: Tue, 17 Dec 2024 13:00:39 +0100 Subject: [PATCH] host/python/uhd/imgbuilder/image_builder.py: Do not use os.system, as it encodes the return value os.system's return value is the process's return value, but encoded in the wait format on Linux which means, that the result is multiplied by 256. Thus a return value of 1 of the executed command results in a ret_val of 256, an return value of 2 means 512, and so on. If this value is forwarded without further handling, and naively used as "normal" exit status, then the value overflows and always results in a 0 exit code. Instead of implementing a Windows/Linux dependant workaround, using subprocess instead of os.system is better anyway, as the usage of os.system is discouraged. Signed-off-by: Frederik Pfautsch --- host/python/uhd/rfnoc_utils/image_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host/python/uhd/rfnoc_utils/image_builder.py b/host/python/uhd/rfnoc_utils/image_builder.py index 0fa382a819..434c9d9396 100644 --- a/host/python/uhd/rfnoc_utils/image_builder.py +++ b/host/python/uhd/rfnoc_utils/image_builder.py @@ -294,7 +294,7 @@ def build(fpga_top_dir, device, build_dir, use_secure_netlist, **args): os.chdir(fpga_top_dir) make_cmd = f'{BASH_EXECUTABLE} -c "{make_cmd}"' logging.info("Executing the following command: %s", make_cmd) - ret_val = os.system(make_cmd) + ret_val = subprocess.call(make_cmd, shell=True) if ret_val == 0 and args.get("secure_core"): patch_netlist_constraints(device, build_dir) os.chdir(cwd)