1
0
Fork 0

Make sure @php path/to/bla gets executed as php path\to\bla on windows, fixes #6968

pull/9713/head
Jordi Boggiano 2021-02-23 08:57:35 +01:00
parent 8f7597da22
commit 057006da4f
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@ use Composer\DependencyResolver\Transaction;
use Composer\Installer\InstallerEvent;
use Composer\IO\IOInterface;
use Composer\Composer;
use Composer\Util\Platform;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\Repository\RepositoryInterface;
use Composer\Script;
@ -250,7 +251,13 @@ class EventDispatcher
continue;
}
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 {
$finder = new PhpExecutableFinder();
$phpPath = $finder->find(false);