Skip to content

Commit 2b5b9e1

Browse files
authored
Return code 1 if downlod fails in CLI (#188)
Signed-off-by: They Who Shall Be Named <93336740+theywhoshallbenamed@users.noreply.github.com>
1 parent 2851ad8 commit 2b5b9e1

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/onthespot/cli.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def main():
115115
mirrorplayback.start()
116116

117117
if args.download:
118+
failed_download = False
118119
print(f"\033[32mParsing URL: {args.download}\033[0m")
119120
parse_url(args.download)
120121
while not download_queue:
@@ -126,9 +127,14 @@ def main():
126127
for item in download_queue.values():
127128
if item['item_status'] in ('Unavailable', 'Failed'):
128129
print(f"\033[31mItem ID {item['item_id']} {item['item_status']}'\033[0m")
130+
failed_download = True
129131

130-
print("\033[32mDownload Completed. Exiting...\033[0m")
131-
os._exit(0)
132+
if failed_download:
133+
print("\033[31mAt least one track download failed. Exiting with failure...\033[0m")
134+
os._exit(1)
135+
else:
136+
print("\033[32mDownload Completed. Exiting...\033[0m")
137+
os._exit(0)
132138

133139
CLI().cmdloop()
134140

0 commit comments

Comments
 (0)