Fail hard if a package can not be properly removed

main
Jordi Boggiano 13 years ago
parent b141ba4322
commit 9371253e38

@ -101,7 +101,9 @@ class FileDownloader implements DownloaderInterface
*/ */
public function remove(PackageInterface $package, $path) public function remove(PackageInterface $package, $path)
{ {
$this->filesystem->removeDirectory($path); if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
} }
/** /**

@ -77,7 +77,9 @@ abstract class VcsDownloader implements DownloaderInterface
public function remove(PackageInterface $package, $path) public function remove(PackageInterface $package, $path)
{ {
$this->enforceCleanDirectory($path); $this->enforceCleanDirectory($path);
$this->filesystem->removeDirectory($path); if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
} }
/** /**

@ -34,7 +34,7 @@ class Filesystem
// clear stat cache because external processes aren't tracked by the php stat cache // clear stat cache because external processes aren't tracked by the php stat cache
clearstatcache(); clearstatcache();
return $result; return $result && !is_dir($directory);
} }
public function ensureDirectoryExists($directory) public function ensureDirectoryExists($directory)

Loading…
Cancel
Save