@@ -525,8 +525,8 @@ public function magentoCLI($command, $timeout = null, $arguments = null)
525525 {
526526 $ magentoBinary = realpath (MAGENTO_BP . DIRECTORY_SEPARATOR . 'bin ' . DIRECTORY_SEPARATOR . 'magento ' );
527527 $ 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 ) {
530530 return $ this ->shellExecMagentoCLI ($ magentoBinary , $ command , $ timeout , $ arguments );
531531 } else {
532532 return $ this ->curlExecMagentoCLI ($ command , $ timeout , $ arguments );
@@ -854,16 +854,18 @@ private function shellExecMagentoCLI($magentoBinary, $command, $timeout, $argume
854854 {
855855 $ php = PHP_BINDIR ? PHP_BINDIR . DIRECTORY_SEPARATOR . 'php ' : 'php ' ;
856856 $ fullCommand = $ php . ' -f ' . $ magentoBinary . ' ' . $ command . ' ' . $ arguments ;
857- $ process = new Process (escapeshellcmd ($ fullCommand ), MAGENTO_BP );
857+ $ process = Process:: fromShellCommandline (escapeshellcmd ($ fullCommand ), MAGENTO_BP );
858858 $ process ->setIdleTimeout ($ timeout );
859859 $ process ->setTimeout (0 );
860860 try {
861861 $ 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+ }
867869 }
868870 }
869871 if (empty ($ output )) {
@@ -967,4 +969,5 @@ private function checkForFilePath($string)
967969 {
968970 return preg_match ('/\/[\S]+\// ' , $ string );
969971 }
970- }
972+ }
973+
0 commit comments