diff --git a/goat_monitor/goat_monitor.py b/goat_monitor/goat_monitor.py index 98c375f..91747fa 100644 --- a/goat_monitor/goat_monitor.py +++ b/goat_monitor/goat_monitor.py @@ -59,7 +59,8 @@ def wrap(command: List[str], config: Path, retries: int, version): if retries < 0: raise ValueError("Invalid number of retries specified") - for attempt in range(retries + 1): + attempt = 0 + while attempt <= retries: # run the command result = subprocess.run( " ".join(command), @@ -101,6 +102,8 @@ def wrap(command: List[str], config: Path, retries: int, version): # only retry on failure break + attempt += 1 + sys.exit(result.returncode)