From 9371253e3828ee071a5913a77cb24c08e04f39f7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 5 Apr 2012 22:58:15 +0200 Subject: [PATCH] Fail hard if a package can not be properly removed --- src/Composer/Downloader/FileDownloader.php | 4 +++- src/Composer/Downloader/VcsDownloader.php | 4 +++- src/Composer/Util/Filesystem.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) 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)