Isolated retry function, reused for drush dl