3

I'm running Drush 10 and have set up site aliases for my local and the remote Drupal site. When I run the following command for my local alias:

drush @local dd

This returns:

var/www/html/abc

But when I run the same command for my remote alias:

drush @remote dd 

This returns:

var/www/html/abc

Connection to "remote" closed

Why is the output different? Is there any chance to avoid the "connection closed" message?

3
  • I guess Drush opens a SSH connection to the remote, performs the command, returns you the output of that command and then tells you that it closed the SSH connection again, no? What happens with other commands, like let's say cache:rebuild? Is it the same?
    – leymannx
    Commented Jul 30, 2020 at 19:48
  • Ah it seems this is coming from an SSH option that Drush adds. Run drush -v @remote dd to get more verbose output and you'll see what SSH command it actually performs. Then see superuser.com/a/457344/219801. But I have no idea how to prevent this at that point. Can you pass SSH options to Drush site aliases? I don't think so.
    – leymannx
    Commented Jul 30, 2020 at 20:05
  • Wow, just found the --ssh-options. Okay, what happens when you run drush --ssh-options="-o LogLevel=QUIET" @remote dd? Or when you add LogLevel QUIET to your ~/.ssh/config?
    – leymannx
    Commented Jul 30, 2020 at 20:25

1 Answer 1

2

--ssh-options="-o LogLevel=QUIET" suppresses the SSH message but still produces a blank line. Although I couldn't put this into the command line I was able to add this to the self.site.yml file.

ssh:
  options: -i /cert.pem -o LogLevel=QUIET
1
  • It also works to add the same to ~/.drush/drush.yml which fixes it for all sites
    – AdamS
    Commented Jan 6, 2021 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.