@@ -80,13 +80,14 @@ public static function bowerUpdate(Event $event)
8080 */
8181 protected static function executeCommand (Event $ event , $ appDir , $ cmd , $ timeout = 300 )
8282 {
83- $ php = escapeshellarg (self ::getPhp ());
83+ $ php = escapeshellarg (self ::getPhp (false ));
84+ $ phpArgs = implode (' ' , array_map ('escapeshellarg ' , self ::getPhpArguments ()));
8485 $ console = escapeshellarg ($ appDir .'/console ' );
8586 if ($ event ->getIO ()->isDecorated ()) {
8687 $ console .= ' --ansi ' ;
8788 }
8889
89- $ process = new Process ($ php .' ' .$ console .' ' .$ cmd , null , null , null , $ timeout );
90+ $ process = new Process ($ php .( $ phpArgs ? ' ' . $ phpArgs : '' ). ' ' .$ console .' ' .$ cmd , null , null , null , $ timeout );
9091 $ process ->run (function ($ type , $ buffer ) { echo $ buffer ; });
9192 if (!$ process ->isSuccessful ()) {
9293 throw new \RuntimeException (sprintf ('An error occurred when executing the "%s" command. ' , escapeshellarg ($ cmd )));
@@ -113,13 +114,20 @@ protected static function getOptions(Event $event)
113114 * @return string|false
114115 * @throws \RuntimeException
115116 */
116- protected static function getPhp ()
117+ protected static function getPhp ($ includeArgs = true )
117118 {
118- $ phpFinder = new PhpExecutableFinder ;
119- if (!$ phpPath = $ phpFinder ->find ()) {
119+ $ phpFinder = new PhpExecutableFinder () ;
120+ if (!$ phpPath = $ phpFinder ->find ($ includeArgs )) {
120121 throw new \RuntimeException ('The php executable could not be found, add it to your PATH environment variable and try again ' );
121122 }
122123
123124 return $ phpPath ;
124125 }
126+
127+ protected static function getPhpArguments ()
128+ {
129+ $ phpFinder = new PhpExecutableFinder ();
130+
131+ return method_exists ($ phpFinder , 'findArguments ' ) ? $ phpFinder ->findArguments () : array ();
132+ }
125133}
0 commit comments