From 8e512c19b4caec4f08788d609f2e8314c41788b6 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 2 Jun 2024 16:38:19 +0100 Subject: Use a friendlier error when sdcc is not found --- tools/mkdeps.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/mkdeps.py b/tools/mkdeps.py index 455dd06..8881cf0 100755 --- a/tools/mkdeps.py +++ b/tools/mkdeps.py @@ -60,9 +60,12 @@ def main(): for d in sorted(glob.glob(os.path.join(args.dir, "*.c"))): if args.verbose: print("running %r" % " ".join(cmd + [d])) - out = subprocess.run(cmd + [d], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if out.returncode: - sys.exit("Error: %s" % out.stderr) + try: + out = subprocess.run(cmd + [d], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + if out.returncode: + sys.exit("Error: %s" % out.stderr) + except FileNotFoundError: + sys.exit(f"Error: {cmd[0]} not found in the PATH") out = out.stdout.decode("utf-8").strip("\n\r") result.append(re.sub(FIX_RE, fix_path, out)) -- cgit v1.2.3