Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 12, 2025. It is now read-only.

Commit d2f51eb

Browse files
committed
Merge pull request #124 from lavoiesl/hhvm-composer
Added support for HHVM in ScriptHandler
2 parents 2e244df + 7084d1b commit d2f51eb

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

Composer/ScriptHandler.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"require": {
2020
"php": ">=5.3.3",
2121
"symfony/framework-bundle": "~2.1",
22-
"symfony/process": "~2.1",
22+
"symfony/process": "~2.3,>=2.3.20 | ~2.4,>=2.4.10 | ~2.5,>=2.5.5",
2323
"doctrine/collections": "1.*",
2424
"symfony/assetic-bundle": "~2.1",
2525
"doctrine/cache": "~1.0"

0 commit comments

Comments
 (0)