Browse Source

adding PHP_BINARY as env var to script execution

Christopher Hertel 6 năm trước cách đây
mục cha
commit
e5989fcfe0
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      src/Composer/EventDispatcher/EventDispatcher.php

+ 6 - 0
src/Composer/EventDispatcher/EventDispatcher.php

@@ -244,6 +244,12 @@ class EventDispatcher
 
                 if (substr($exec, 0, 5) === '@php ') {
                     $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
+                } else {
+                    $finder = new PhpExecutableFinder();
+                    $phpPath = $finder->find(false);
+                    if ($phpPath) {
+                        putenv('PHP_BINARY=' . $phpPath);
+                    }
                 }
 
                 if (0 !== ($exitCode = $this->process->execute($exec))) {