From 2948248d7a05820c21b7edb57bdb8570e350b170 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 15 Nov 2022 14:35:44 +0100 Subject: Remove exit(0) (#33896) Since they cause --backtrace to report backtraces even with exit code 0 --- lib/spack/spack/cmd/buildcache.py | 13 ++++++------- lib/spack/spack/cmd/ci.py | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/spack/spack/cmd/buildcache.py b/lib/spack/spack/cmd/buildcache.py index d25f243039..061a34a438 100644 --- a/lib/spack/spack/cmd/buildcache.py +++ b/lib/spack/spack/cmd/buildcache.py @@ -454,7 +454,7 @@ def check_fn(args): if not specs: tty.msg("No specs provided, exiting.") - sys.exit(0) + return for spec in specs: spec.concretize() @@ -467,9 +467,10 @@ def check_fn(args): if not configured_mirrors: tty.msg("No mirrors provided, exiting.") - sys.exit(0) + return - sys.exit(bindist.check_specs_against_mirrors(configured_mirrors, specs, args.output_file)) + if bindist.check_specs_against_mirrors(configured_mirrors, specs, args.output_file) == 1: + sys.exit(1) def download_fn(args): @@ -479,11 +480,11 @@ def download_fn(args): least one of the required buildcache components.""" if not args.spec and not args.spec_file: tty.msg("No specs provided, exiting.") - sys.exit(0) + return if not args.path: tty.msg("No download path provided, exiting") - sys.exit(0) + return spec = _concrete_spec_from_args(args) result = bindist.download_single_spec(spec, args.path) @@ -532,8 +533,6 @@ def save_specfile_fn(args): root_spec_as_json, args.specfile_dir, args.specs.split(), spec_format ) - sys.exit(0) - def copy_buildcache_file(src_url, dest_url, local_path=None): """Copy from source url to destination url""" diff --git a/lib/spack/spack/cmd/ci.py b/lib/spack/spack/cmd/ci.py index 168455bf9c..6822772139 100644 --- a/lib/spack/spack/cmd/ci.py +++ b/lib/spack/spack/cmd/ci.py @@ -6,7 +6,6 @@ import json import os import shutil -import sys import llnl.util.filesystem as fs import llnl.util.tty as tty @@ -503,7 +502,7 @@ def ci_rebuild(args): bindist.download_single_spec(job_spec, build_cache_dir, mirror_url=matching_mirror) # Now we are done and successful - sys.exit(0) + return 0 # Before beginning the install, if this is a "rebuild everything" pipeline, we # only want to keep the mirror being used by the current pipeline as it's binary -- cgit v1.2.3-60-g2f50