-
Notifications
You must be signed in to change notification settings - Fork 224
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
Capturing the command output via Robo does not work anymore (regression in 7.0.0) #1149
Comments
@amenk yes, we call all Core commands now as sub-process (via Symfony Process).
Sadly I will not be available until next week to do serious work on n98-magerun2 to fix this issue. |
The output is passed to the output of the command. $process->run(function ($type, $buffer) use ($output) {
$output->write($buffer);
}); |
I just did a test in the Magerun dev box with this RoboFile. <?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see https://robo.li/
*/
class RoboFile extends \Robo\Tasks
{
private function magerunTwoWithResult(string $command): string
{
return $this->taskExec(sprintf('php8.2 %s %s', './n98-magerun2.phar --root-dir=/opt/magento-test-environments/magento_2_4_6/', $command))
->printOutput(false)
->run()
->getMessage();
}
public function deployModeShow()
{
return $this->magerunTwoWithResult('deploy:mode:show');
}
} I did a test with "bin/n98-magerun2" and the phar file. What I currently see is that we do not prepend the PHP interpreter to the bin/magento call. |
Not sure if the output comes from robo or from magerun. Can you try
The PHP interpreter is not that important anymore, we use that only temporarily. We are on Magento 2.4.5-p1 + PHP8.1 by the way |
@amenk: Please try and see if it works:
and please share which operating system and shell. This might be similar: composer/composer#9454 (comment) |
@ktomk |
@amenk Thanks, that's what I thought. Can you try to invoke robo prefixed with the |
@ktomk
I guess this is what you meant |
We use the TTY mode of the Symfony Process depends if the tool is started interactive or non-interactive. There is also a Pty Mode. I have not tested this, because I had not had any issues. |
I changed |
@ktomk do you think we handle that in n98-magerun2 in any way? |
@amenk have you tried with |
From my point of view we could close this issue. Thank you very much! |
Same as composer likely, this is how I read the recent testing (thanks @amenk). This works because of
For regression testing it would be good to have a branch with a robo task that demonstrates it. @amenk, would it be easy to create and push? If all goes well it should be easy to fix and then we would not need to provide addition read-me/release notes on such easy to miss/puzzling behaviour (by behaviour also a regression). |
We are using Robo v4 and n98-magerun2 in the following way:
Expected behaviour
When calling the above function in the RoboFile for example with
deploy:mode:show
we get the output (verified with 6.1.1), but with 7.0.0 we get an empty result. Robo v3.0.10 and magerun2 v7.0.0 show the same problem.Steps to reproduce the issue
Workaround
When calling bin/magento instead of magerun2 it works.
Was there anything changed in the TTY handling or something like this which could cause this issue?
The text was updated successfully, but these errors were encountered: