Skip to content

Remote command on Windows gets stuck, doesn't display output #49

@Ambient-Impact

Description

@Ambient-Impact

Opening this in continuation of drush-ops/drush#4199.

Describe the bug or behavior
On Windows, attempting a drush @alias status (or any command really; @alias is a remote site alias) results in the process running indefinitely with no visible output most of the time. Occasionally, a single line of output appears but the process still doesn't exit.

To Reproduce
drush @alias status

Expected behavior
Process should display output and exit.

Actual behavior
Process doesn't exit, usually no output.

Workaround
Running with -vvv and copying/pasting the ssh command that's generated.

System Configuration

Q A
Drush version? 10.2.0
Drupal version? 8.8.1
PHP version 7.2.13
OS? Windows

Additional information
After a lot more digging in addition to the linked Drush issue, the exact location that execution is getting stuck is in Symfony\Component\Process\Pipes\AbstractPipes::write() on line 132:

$written = fwrite($stdin, $this->inputBuffer);

On Windows, Symfony\Component\Process\Pipes\WindowsPipes is used, which extends AbstractPipes and uses temporary files as a workaround for various Windows PHP issues. If you open the temporary files that Symfony generates, the remote site output is all there.

With that in mind, it would seem that this would be a Symfony issue, but then if you bypass Drush, creating and running a PHP file (either via drush php:script or directly) like so:

<?php

require '../vendor/autoload.php';

use Symfony\Component\Process\Process;

$process = new Process(<ssh command>);

$process->run();

print $process->getOutput();

the ssh command correctly executes and exits. Replace <ssh command> with the SSH command generated by Drush. This seems to indicate that there's something in Drush or site-process that's doing something a bit differently, possibly in RealtimeOutputHandler?

File system and stream stuff are outside of my area of expertise, so that's as far as I've gotten. I'm not really sure where to go from here, so I'll leave it here for now in case someone else wants to continue looking into 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