Skip to content

Commit 369cbb9

Browse files
committed
minor #25078 [FrameworkBundle] Ignore failures when removing the old cache dir (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Ignore failures when removing the old cache dir | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25066 | License | MIT | Doc PR | - ping @phoenixgao can you please check if this improves the situation? Commits ------- 3c4d168ca9 [FrameworkBundle] Ignore failures when removing the old cache dir
2 parents 03f8319 + 56d05aa commit 369cbb9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Command/CacheClearCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Console\Output\OutputInterface;
1717
use Symfony\Component\Console\Style\SymfonyStyle;
1818
use Symfony\Component\EventDispatcher\EventDispatcher;
19+
use Symfony\Component\Filesystem\Exception\IOException;
1920
use Symfony\Component\Filesystem\Filesystem;
2021
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
2122
use Symfony\Component\HttpKernel\KernelInterface;
@@ -130,7 +131,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
130131
$io->comment('Removing old cache directory...');
131132
}
132133

133-
$this->filesystem->remove($oldCacheDir);
134+
try {
135+
$this->filesystem->remove($oldCacheDir);
136+
} catch (IOException $e) {
137+
$io->warning($e->getMessage());
138+
}
134139

135140
if ($output->isVerbose()) {
136141
$io->comment('Finished');

0 commit comments

Comments
 (0)