Skip to content
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

Drall 2.x and 3.x cannot catch some Drush output #71

Closed
jigarius opened this issue Apr 21, 2023 · 5 comments
Closed

Drall 2.x and 3.x cannot catch some Drush output #71

jigarius opened this issue Apr 21, 2023 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@jigarius
Copy link
Owner

The problem

  • Execute drall ex drush cr
  • The command runs successfully, but Drall cannot display the [success] Cache rebuild complete. message generated by Drush.
@jigarius jigarius added bug Something isn't working help wanted Extra attention is needed labels Apr 21, 2023
@jigarius jigarius added this to the v3.0 milestone Apr 21, 2023
@dasginganinja
Copy link

This is likely related to the fact that drush writes to stderr. You would need to catch both the standard out and the standard error. :)

@dasginganinja
Copy link

I took a look into this today.

It appears you are using the amp library to run the processes (versus Symfony).

Amp separates the output streams into stdout and stderr.
https://github.com/amphp/process/blob/2.x/src/Process.php#L218

Symfony, on the other hand, provides you with a stream and you can get the type of data.
https://symfony.com/doc/current/components/process.html#usage

In your example, you create an amp process.
https://github.com/jigarius/drall/blob/3.x/src/Commands/ExecCommand.php#L156

Perhaps the amp library should be able to provide a stream of both like Symfony does or maybe there is a better way of muxing the data together?

It would be weird to print stdout then stderr since they are timed data and could interweave.
🤔

@jigarius
Copy link
Owner Author

Thanks for the insight. I will do some research in the first week of May and the worst of cases, I'll request AMP maintainers to help.

@jigarius
Copy link
Owner Author

jigarius commented May 3, 2023

I was reading a bit about this and it turns out that Drush writes all log messages to STDERR by design. I think the next step will be to find a way to force all the output into a single stream when running the commands. Maybe we can do something like append 2>&1 to the commands. I'll give that a try and some tests to make sure we get messages like:

[success] Cache rebuild successful.

Reference: drush-ops/drush#707

@jigarius
Copy link
Owner Author

jigarius commented May 3, 2023

I've made a commit that fixes this issue and catches STDERR output correctly. However, there seems to be an irrelevant issue where Drush has an incompatible method declaration. I'll solve that dependency issue first and then continue on fixing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants