From e02737abd13bde9c12a5f1aa526d0e8de2a58416 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Sat, 14 Sep 2024 17:50:59 -0600 Subject: [PATCH] fix behavior with infinite retries --- goat_monitor/goat_monitor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)