tasks/customaction.py
def try_run(ctx, cmd, n):
    """
    Tries to run a command n number of times. If after n tries it still
    fails, returns False.
    """

    for _ in range(n):
        res = ctx.run(cmd, warn=True)
        if res.exited is None or res.exited > 0:
            print(
                color_message(
                    f"Failed to run \"{cmd}\" - retrying",
                    "orange",
                )
            )
            continue
        return True
    return False

    Tries to run a command n number of times. If after n tries it still
    fails, returns False.
    
Tries to run a command n number of times. If after n tries it still
fails, returns False.
Tries to run a command n number of times . If after n tries it still fails returns False .
def try_run(ctx, cmd, n):
    for _ in range(n):
        res = ctx.run(cmd, warn=True)
        if res.exited is None or res.exited > 0:
            print(
                color_message(
                    f"Failed to run \"{cmd}\" - retrying",
                    "orange",
                )
            )
            continue
        return True
    return False
def try_run ( ctx , cmd , n ) : for _ in range ( n ) : res = ctx . run ( cmd , warn = True ) if res . exited is None or res . exited > 0 : print ( color_message ( f"Failed to run \"{cmd}\" - retrying" , "orange" , ) ) continue return True return False
Tries to run a command n number of times.
Tries to run a command n number of times .
"""
    Tries to run a command n number of times. If after n tries it still
    fails, returns False.
    """
ctx
cmd
n