Skip to content

Commit

Permalink
fix: Ensure to not crash when ~/.serverless is not accessible (#11403)
Browse files Browse the repository at this point in the history
  • Loading branch information
THOM-AwS committed Sep 22, 2022
1 parent 93ce41e commit b95c749
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/utils/log-deprecation.js
Expand Up @@ -144,7 +144,17 @@ module.exports.printSummary = async () => {
fse.ensureDir(path.dirname(healthStatusFilename)),
fsp.writeFile(tmpHealthStatusFilename, healthStatus.join('\n')),
]);
await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename);
try {
await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename);
} catch (error) {
if (error.code === 'EACCES') {
log.error(
'Cannot store information on approached deprecation. Please ensure process has write access to the ~/.serverless directory'
);
} else {
throw error;
}
}
} finally {
bufferedDeprecations.length = 0;
}
Expand Down

0 comments on commit b95c749

Please sign in to comment.