Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Try catch chmod.
  • Loading branch information
Jelle-S committed Mar 3, 2017
2 parents 8aff84b + 14be8f4 commit d18c70c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PartialCleanDirs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d18c70c

Please sign in to comment.