protected static function executeWithRetry()

in src/TestUtils/ExecuteCommandTrait.php [135:149]


    protected static function executeWithRetry($cmd, $timeout = false, $retries = 3)
    {
        $process = self::createProcess($cmd, $timeout);
        for ($i = 0; $i <= $retries; $i++) {
            // only allow throwing exceptions on final attempt
            $throwExceptionOnFailure = $i == $retries;
            if (self::executeProcess($process, $throwExceptionOnFailure)) {
                return true;
            }
            if (self::$logger && $i < $retries) {
                self::$logger->debug('Retrying the command: ' . $cmd);
            }
        }
        return false;
    }