Open janbarasek opened 2 years ago
The error seems expected. You simply cannot delete a directory that is actively being written into.
This means that, for example, the cache can never be removed if there are many parallel requests to the application.
How to safely delete the cache contents if there is an error?
For example, the rm -fr temp/cache/*
command will always delete the contents safely and not cause an error to be thrown, like Nette.
This means that, for example, the cache can never be removed if there are many parallel requests to the application.
You can remove individual files, just not the directory itself.
For example, the
rm -fr temp/cache/*
command will always delete the contents safely and not cause an error to be thrown, like Nette.
That's because of -f
option. It only mutes errors. Try -r
only on rush directory. You get Directory not empty
.
So could Nette implement a force
switch? There are certainly valid cases where this is useful.
New files may be created by another process while the directory is being deleted. The deletion will then fail. The new implementation repeatedly checks the files in the directory.
Demo:
Thanks.