Skip to content

drush fails to receive output from non interactive ssh commands in some circumstances #2805

@johnennewdeeson

Description

@johnennewdeeson

Hi,

I'm using docker and the following docker image to provide an SSH container https://hub.docker.com/r/jeroenpeeters/docker-ssh/

I want to access a docker based Drupal site using drush and drush aliases. Everything works apart from drush commands that execute SSH commands non interactively. An example being user-login e.g. drush @docker uli

Degbugging shows the SSH command is executed but drush running outside of the container receives no output from the command. If I manually run the SSH command drush creates, it works fine so its just that the output is not ending up at the local version of drush running outside the container.

On further investigation I found that in backend.inc, the process pipe gets deliberately closed. If I comment this fclose out then the command works as expected.

The line is in _drush_backend_proc_open(). In drush 8.1.12 its line 389. I've copied it below along with the comment that goes above it:-

    // If we do not close stdin here, then we cause a deadlock;
    // see: http://drupal.org/node/766080#comment-4309936
    // If we reimplement interactive commands to also use
    // _drush_proc_open, then clearly we would need to keep
    // this open longer.
    fclose($process['pipes'][0]); // <-- if I comment this line out drush @docker uli works as expected

Clearly this works in most environments, I was wondering what might be special with my setup that requires the removal of this line? What is it even there for? I couldn't work it out from the comment!

If others happen across this issue then maybe an optional toggle can be added to an alias to prevent this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions