Make sure cd call allows switching drives on windows, fixes #1971
parent
8b8dc1fd70
commit
4cac2caf70
|
@ -30,7 +30,8 @@ class GitDownloader extends VcsDownloader
|
||||||
$this->cleanEnv();
|
$this->cleanEnv();
|
||||||
|
|
||||||
$ref = $package->getSourceReference();
|
$ref = $package->getSourceReference();
|
||||||
$command = 'git clone %s %s && cd %2$s && git remote add composer %1$s && git fetch composer';
|
$flag = defined('PHP_WINDOWS_VERSION_MAJOR') ? '/D ' : '';
|
||||||
|
$command = 'git clone %s %s && cd '.$flag.'%2$s && git remote add composer %1$s && git fetch composer';
|
||||||
$this->io->write(" Cloning ".$ref);
|
$this->io->write(" Cloning ".$ref);
|
||||||
|
|
||||||
$commandCallable = function($url) use ($ref, $path, $command) {
|
$commandCallable = function($url) use ($ref, $path, $command) {
|
||||||
|
|
|
@ -300,6 +300,8 @@ class GitDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||||
private function getCmd($cmd)
|
private function getCmd($cmd)
|
||||||
{
|
{
|
||||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||||
|
$cmd = str_replace('cd ', 'cd /D ', $cmd);
|
||||||
|
|
||||||
return strtr($cmd, "'", '"');
|
return strtr($cmd, "'", '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue