chirpc: Fix exit code on successful --download-mmap and --upload-mmap

sys.exit(1) was called unconditionally after the try/except block in
both the download and upload paths, returning failure even when the
operation succeeded. Move sys.exit(1) inside the except block and add
sys.exit(0) on success.
This commit is contained in:
Mark Wolfe 2026-05-02 18:08:04 -07:00
parent 68546632f7
commit cde8745c34

View file

@ -379,9 +379,11 @@ def main(args=None):
try:
radio.sync_in()
radio.save_mmap(options.mmap)
LOG.info("Download successful: %s", options.mmap)
sys.exit(0)
except Exception as e:
LOG.exception(e)
sys.exit(1)
sys.exit(1)
if options.upload_mmap:
if not issubclass(rclass, chirp_common.CloneModeRadio):
@ -394,9 +396,10 @@ def main(args=None):
radio.load_mmap(options.mmap)
radio.sync_out()
print("Upload successful")
sys.exit(0)
except Exception as e:
LOG.exception(e)
sys.exit(1)
sys.exit(1)
if options.mmap and isinstance(radio, chirp_common.CloneModeRadio):
radio.save_mmap(options.mmap)