@@ -525,8 +525,8 @@ public function magentoCLI($command, $timeout = null, $arguments = null)
525
525
{
526
526
$ magentoBinary = realpath (MAGENTO_BP . DIRECTORY_SEPARATOR . 'bin ' . DIRECTORY_SEPARATOR . 'magento ' );
527
527
$ valid = $ this ->validateCommand ($ magentoBinary , $ command );
528
- // execute from shell when running tests from web root -- excludes cron jobs .
529
- if ($ valid && strpos ( $ command , self :: COMMAND_CRON_RUN ) === false ) {
528
+ // execute from shell when running tests from web root.
529
+ if ($ valid ) {
530
530
return $ this ->shellExecMagentoCLI ($ magentoBinary , $ command , $ timeout , $ arguments );
531
531
} else {
532
532
return $ this ->curlExecMagentoCLI ($ command , $ timeout , $ arguments );
@@ -854,16 +854,18 @@ private function shellExecMagentoCLI($magentoBinary, $command, $timeout, $argume
854
854
{
855
855
$ php = PHP_BINDIR ? PHP_BINDIR . DIRECTORY_SEPARATOR . 'php ' : 'php ' ;
856
856
$ fullCommand = $ php . ' -f ' . $ magentoBinary . ' ' . $ command . ' ' . $ arguments ;
857
- $ process = new Process (escapeshellcmd ($ fullCommand ), MAGENTO_BP );
857
+ $ process = Process:: fromShellCommandline (escapeshellcmd ($ fullCommand ), MAGENTO_BP );
858
858
$ process ->setIdleTimeout ($ timeout );
859
859
$ process ->setTimeout (0 );
860
860
try {
861
861
$ process ->run ();
862
- $ output = $ process ->getOutput ();
863
- if (!$ process ->isSuccessful ()) {
864
- $ failureOutput = $ process ->getErrorOutput ();
865
- if (!empty ($ failureOutput )) {
866
- $ output = $ failureOutput ;
862
+ if (strpos ($ command , self ::COMMAND_CRON_RUN ) === false ) {
863
+ $ output = $ process ->getOutput ();
864
+ if (!$ process ->isSuccessful ()) {
865
+ $ failureOutput = $ process ->getErrorOutput ();
866
+ if (!empty ($ failureOutput )) {
867
+ $ output = $ failureOutput ;
868
+ }
867
869
}
868
870
}
869
871
if (empty ($ output )) {
@@ -967,4 +969,5 @@ private function checkForFilePath($string)
967
969
{
968
970
return preg_match ('/\/[\S]+\// ' , $ string );
969
971
}
970
- }
972
+ }
973
+
0 commit comments