Run a command and retry it if it fails.