Make sure @php path/to/bla gets executed as php path\to\bla on windows, fixes #6968
parent
8f7597da22
commit
057006da4f
|
@ -16,6 +16,7 @@ use Composer\DependencyResolver\Transaction;
|
||||||
use Composer\Installer\InstallerEvent;
|
use Composer\Installer\InstallerEvent;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Composer;
|
use Composer\Composer;
|
||||||
|
use Composer\Util\Platform;
|
||||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Script;
|
use Composer\Script;
|
||||||
|
@ -250,7 +251,13 @@ class EventDispatcher
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strpos($exec, '@php ') === 0) {
|
if (strpos($exec, '@php ') === 0) {
|
||||||
$exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
|
$pathAndArgs = substr($exec, 5);
|
||||||
|
if (Platform::isWindows()) {
|
||||||
|
$pathAndArgs = preg_replace_callback('{^\S+}', function ($path) {
|
||||||
|
return str_replace('/', '\\', $path[0]);
|
||||||
|
}, $pathAndArgs);
|
||||||
|
}
|
||||||
|
$exec = $this->getPhpExecCommand() . ' ' . $pathAndArgs;
|
||||||
} else {
|
} else {
|
||||||
$finder = new PhpExecutableFinder();
|
$finder = new PhpExecutableFinder();
|
||||||
$phpPath = $finder->find(false);
|
$phpPath = $finder->find(false);
|
||||||
|
|
Loading…
Reference in New Issue