From 5d3fdbf7c203b05e13edab7b4f9981b19877f368 Mon Sep 17 00:00:00 2001 From: azjezz <29315886+azjezz@users.noreply.github.com> Date: Tue, 22 Jan 2019 23:32:09 +0100 Subject: [PATCH] Update ComposerPlugin.php (#33) --- src/ComposerPlugin.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ComposerPlugin.php b/src/ComposerPlugin.php index ef31e5a..d2654f9 100644 --- a/src/ComposerPlugin.php +++ b/src/ComposerPlugin.php @@ -20,6 +20,8 @@ use Composer\Plugin\PluginInterface; use Composer\Script\Event; use Composer\Script\ScriptEvents; +use Composer\Util\ProcessExecutor; +use Symfony\Component\Process\ExecutableFinder; /** Plugin for PHP composer to automatically update the autoload map whenever * dependencies are changed or updated. @@ -58,6 +60,10 @@ public static function getSubscribedEvents() { */ public function onPostAutoloadDump(Event $event) { $args = $event->isDevMode() ? '' : ' --no-dev'; - shell_exec('hhvm '.escapeshellarg($this->vendor.'/bin/hh-autoload').$args); + $finder = new ExecutableFinder(); + $hhvm = $finder->find('hhvm', 'hhvm'); + $executor = new ProcessExecutor($this->io); + $command = $hhvm . ' ' . ProcessExecutor::escape($this->vendor.'/bin/hh-autoload') . $args; + $executor->execute($command); } }