diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 4ddd01ca7..356934514 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -101,7 +101,9 @@ class FileDownloader implements DownloaderInterface */ public function remove(PackageInterface $package, $path) { - $this->filesystem->removeDirectory($path); + if (!$this->filesystem->removeDirectory($path)) { + throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); + } } /** diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index 8c264f7bb..2d19bba40 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -77,7 +77,9 @@ abstract class VcsDownloader implements DownloaderInterface public function remove(PackageInterface $package, $path) { $this->enforceCleanDirectory($path); - $this->filesystem->removeDirectory($path); + if (!$this->filesystem->removeDirectory($path)) { + throw new \RuntimeException('Could not completely delete '.$path.', aborting.'); + } } /** diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 88e8a77c2..fd60cd2fd 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -34,7 +34,7 @@ class Filesystem // clear stat cache because external processes aren't tracked by the php stat cache clearstatcache(); - return $result; + return $result && !is_dir($directory); } public function ensureDirectoryExists($directory)