From 5c5f87008fcad19c7df54c7c18e7977acb2d0da5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 10 Apr 2012 09:43:47 +0200 Subject: [PATCH] Report proper error if a write fails instead of saying the download failed --- src/Composer/Util/RemoteFilesystem.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 4d0433f38..f6cfa67da 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -130,9 +130,16 @@ class RemoteFilesystem } } + if ($this->progress) { + $this->io->overwrite(" Downloading: 100%"); + } + // handle copy command if download was successful if (false !== $result && null !== $fileName) { $result = (Boolean) @file_put_contents($fileName, $result); + if (false === $result) { + throw new TransportException('The "'.$fileUrl.'" file could not be written to '.$fileName); + } } // avoid overriding if content was loaded by a sub-call to get() @@ -140,10 +147,6 @@ class RemoteFilesystem $this->result = $result; } - if ($this->progress) { - $this->io->overwrite(" Downloading: 100%"); - } - if (false === $this->result) { throw new TransportException('The "'.$fileUrl.'" file could not be downloaded'); }