Skip to content

Commit 319b661

Browse files
authored
Merge pull request espressif#111 from adafruit/retry-failed-install
retry up to 3 times for run_or_die()
2 parents 3907bae + 4d09c4a commit 319b661

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: build_platform.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,15 @@ def install_platform(platform):
179179

180180
def run_or_die(cmd, error):
181181
print(cmd)
182-
if os.system(cmd) != 0:
183-
ColorPrint.print_fail(error)
184-
exit(-1)
182+
attempt = 0
183+
while attempt < 3:
184+
if os.system(cmd) == 0:
185+
return
186+
attempt += 1
187+
print('attempt {} failed, {} retry left'.format(attempt, 3-attempt))
188+
time.sleep(5)
189+
ColorPrint.print_fail(error)
190+
exit(-1)
185191

186192
################################ Install Arduino IDE
187193
print()

0 commit comments

Comments
 (0)