mirror of https://github.com/status-im/metro.git
Protect against races in deleting corrupt cache
Reviewed By: @cpojer Differential Revision: D2426450
This commit is contained in:
parent
68fb275c78
commit
c308774bc1
|
@ -20,7 +20,11 @@ function loadCacheSync(cachePath) {
|
|||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
console.warn('Unable to parse cache file. Will clear and continue.');
|
||||
fs.unlinkSync(cachePath);
|
||||
try {
|
||||
fs.unlinkSync(cachePath);
|
||||
} catch (err) {
|
||||
// Someone else might've deleted it.
|
||||
}
|
||||
return Object.create(null);
|
||||
}
|
||||
throw e;
|
||||
|
|
Loading…
Reference in New Issue