1
0
Fork 0

Fixed the resetting of the json file on removal failures

Closes #3329
pull/3330/head
Christophe Coevoet 2014-10-05 14:30:44 +02:00
parent 6c0afd3fc0
commit 4685b4bf49
1 changed files with 5 additions and 5 deletions

View File

@ -59,11 +59,11 @@ EOT
$file = Factory::getComposerFile();
$json = new JsonFile($file);
$composer = $json->read();
$composerBackup = file_get_contents($json->getPath());
$jsonFile = new JsonFile($file);
$composer = $jsonFile->read();
$composerBackup = file_get_contents($jsonFile->getPath());
$json = new JsonConfigSource($json);
$json = new JsonConfigSource($jsonFile);
$type = $input->getOption('dev') ? 'require-dev' : 'require';
$altType = !$input->getOption('dev') ? 'require-dev' : 'require';
@ -110,7 +110,7 @@ EOT
$status = $install->run();
if ($status !== 0) {
$output->writeln("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
file_put_contents($json->getPath(), $composerBackup);
file_put_contents($jsonFile->getPath(), $composerBackup);
}
return $status;