Better feedback for failing SSH commands. #2616
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you are running Drush commands on a remote host and SSH fails for any reason (say, because you forgot to spin up your DrupalVM or Vagrant Box, or the remote host is unavailable), you have to wait two minutes to find out that there's anything wrong, and then Drush silently exits with no indication of any error. Needless to say, this is a pretty bad UX and causes a lot of confusion and issue churn (just search the issue queue for "SSH").
This is a fairly simple solution. It's a little tricky to determine if a failed command is due to a problem with SSH or something else, so it's possible that this could produce false positives. If we want to make it more selective, we could just check for an error_status of 255, which indicates SSH failed to connect. And maybe verify that SSH was actually used to call the command. Let me know where you want to go with it.