diff --git a/fifloader.py b/fifloader.py index ea3ac0e1..3b1eb43b 100755 --- a/fifloader.py +++ b/fifloader.py @@ -342,15 +342,15 @@ def run(args): loadargs.append('-') tries = 20 while True: - ret = subprocess.run(loadargs, input=json.dumps(out), text=True, check=True) - if ret.returncode: + try: + subprocess.run(loadargs, input=json.dumps(out), text=True, check=True) + break + except subprocess.CalledProcessError: if tries: print(f"loader failed! retrying ({tries} attempts remaining)") tries -= 1 else: sys.exit("loader failed and all retries exhausted!") - else: - break def main(): """Main loop."""