-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote command on Windows gets stuck, doesn't display output #49
Comments
What ssh command are you running in your test? Does the command use stdin in any way? I presume not, since your test script does not handle stdin, and site process is hanging trying to provide stdin. It seems that the fix here is to recognize that |
I've tried both |
Oh wait, you're probably referring to the SSH command generated by Drush. Here's the full output, with some stuff redacted in uppercase:
Copying and running the command after |
So the interesting question is, what is the state of One thing to try: does it work better on Windows if you pass the Those things will affect how Drush is interacting with Symfony process. It is likely that in the non-working case on Windows, Drush it providing the tty from the terminal, and Symfony process is waiting for a control-D from the keyboard to indicate that stdin is finished. Try non-interactive, and try piped input, and try typing control-D when it's frozen, and see if any of those things affect the behavior. The solution here is probably going to involve testing in advance (if possible) that there is no stdin available, and change how Drush calls Site Process when there is no stdin. If the |
Doing a crude
|
Casual inspection of the code appears to indicate that Site Process handles $input in the same way as the working sample shown in the OP. More investigation into the root cause is needed. |
(nods) Anything else you'd like me to try? |
Change your working example above to use code that more closely matches the actual code in Site Process, and see if you can make it break. Change the code in Site Process to be more like the code in your working example (removing features, just to test) and see if you can make it start working. Trace through the code and see if you can find something that is setting a mode or changing the state of the Process object in any way that is causing it to break. |
I'll give those a try one of these days when I get a chance. |
After some trial and error, I've got this example working in all three cases, printing out the
The last one is copied and modified from |
Just pass STDOUT into setRealtimeOutput (just like the test, but omit making the buffered output objects) if you want output to go right to the console. However, outputting to the console is not really testable, so I would way that it's not important to do it in this test script. It would be good to try it out once ad-hoc, just to confirm that it works. After that, you can take it on faith that STDOUT will work the same way as the buffered output stream used in the test. |
Sorry for disappearing. Been really busy but will get back to this when I have some more time. |
Just to be clear, I mean for this particular test. In general, the behavior of exec / ssh, with tty vs without tty and etc. makes it difficult to predict how capturing vs. non-capturing modes work. This is why confirming that things work right with ad-hoc testing first is a very important step, to ensure that the tests -- which should guard against change in behavior -- are in fact testing against a known good / working state. |
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 thessh
command that's generated.System Configuration
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:On Windows,
Symfony\Component\Process\Pipes\WindowsPipes
is used, which extendsAbstractPipes
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: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 inRealtimeOutputHandler
?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.
The text was updated successfully, but these errors were encountered: