From 14be8f481614bffbb3382554410d0948a0924a87 Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Fri, 3 Mar 2017 14:01:12 +0100 Subject: [PATCH] Try catch chmod. --- src/PartialCleanDirs.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PartialCleanDirs.php b/src/PartialCleanDirs.php index 5ce20c3..001d9c4 100644 --- a/src/PartialCleanDirs.php +++ b/src/PartialCleanDirs.php @@ -3,6 +3,7 @@ namespace DigipolisGent\Robo\Task\Deploy; use Robo\Task\BaseTask; +use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; @@ -245,7 +246,11 @@ protected function cleanDir($dir, $keep) array_splice($items, -$keep); } foreach ($items as $item) { - $this->fs->chmod($item, 0777, 0000, true); + try { + $this->fs->chmod($item, 0777, 0000, true); + } catch (IOException $e) { + // If chmod didn't work, try to remove anyway. + } $this->fs->remove($item); } }