From 1e8bb0b13c5668ef9c6caad29dc3d55164522e8a Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Sat, 19 Jun 2021 09:20:06 +0200 Subject: [PATCH] added case if clean_process or add_process return -1 --- source/patch_track.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/patch_track.py b/source/patch_track.py index 8ab546f..86959e3 100644 --- a/source/patch_track.py +++ b/source/patch_track.py @@ -114,8 +114,14 @@ def patch_track(self, tracks, total_track="?"): track_file = get_trackname(track=track) while True: if len(process_list) < max_process: - if add_process(track_file) == 0: break - else: clean_process() - while clean_process() != 1: pass # End the process if all process ended + returncode = add_process(track_file) + if returncode == 0: break + elif returncode == -1: return -1 # if error occur, stop function + elif clean_process() == -1: return -1 + + while True: + returncode = clean_process() + if returncode == 1: break # End the process if all process ended + elif returncode == -1: return return 0 \ No newline at end of file