Skip to content

Commit

Permalink
Fix: Cache file error handling on read-only file system. (fixes #11945)…
Browse files Browse the repository at this point in the history
… (#11946)
  • Loading branch information
cuki authored and mysticatea committed Jul 17, 2019
1 parent 89412c3 commit cb475fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/cli-engine/cli-engine.js
Expand Up @@ -734,7 +734,10 @@ class CLIEngine {
try {
fs.unlinkSync(cacheFilePath);
} catch (error) {
if (!error || error.code !== "ENOENT") {
const errorCode = error && error.code;

// Ignore errors when no such file exists or file system is read only (and cache file does not exist)
if (errorCode !== "ENOENT" && !(errorCode === "EROFS" && !fs.existsSync(cacheFilePath))) {
throw error;
}
}
Expand Down

0 comments on commit cb475fd

Please sign in to comment.