8000 Fix composer resolution on windows · symfony/symfony@746f83a · GitHub
[go: up one dir, main page]

Skip to content

Commit 746f83a

Browse files
Rainridernicolas-grekas
authored andcommitted
Fix composer resolution on windows
Prepend the php executable to the resolved composer path when `COMPOSER_BINARY` is set.
1 parent a4992b0 commit 746f83a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,13 @@
150150
putenv('SYMFONY_DEPRECATIONS_HELPER=disabled');
151151
}
152152

153-
if (false === $COMPOSER = getenv('COMPOSER_BINARY')) {
154-
$COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar')
155-
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
156-
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
157-
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
158-
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
159-
: 'composer';
160-
}
153+
$COMPOSER = ($COMPOSER = getenv('COMPOSER_BINARY'))
154+
|| file_exists($COMPOSER = $oldPwd.'/composer.phar')
155+
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`)))
156+
|| ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`)))
157+
|| file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar')
158+
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
159+
: 'composer';
161160

162161
$prevCacheDir = getenv('COMPOSER_CACHE_DIR');
163162
if ($prevCacheDir) {

0 commit comments

Comments
 (0)
0