Skip to content

Commit d18c70c

Browse files
committed
Merge branch 'develop'
* develop: Try catch chmod.
2 parents 8aff84b + 14be8f4 commit d18c70c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/PartialCleanDirs.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace DigipolisGent\Robo\Task\Deploy;
44

55
use Robo\Task\BaseTask;
6+
use Symfony\Component\Filesystem\Exception\IOException;
67
use Symfony\Component\Filesystem\Filesystem;
78
use Symfony\Component\Finder\Finder;
89

@@ -245,7 +246,11 @@ protected function cleanDir($dir, $keep)
245246
array_splice($items, -$keep);
246247
}
247248
foreach ($items as $item) {
248-
$this->fs->chmod($item, 0777, 0000, true);
249+
try {
250+
$this->fs->chmod($item, 0777, 0000, true);
251+
} catch (IOException $e) {
252+
// If chmod didn't work, try to remove anyway.
253+
}
249254
$this->fs->remove($item);
250255
}
251256
}

0 commit comments

Comments
 (0)