Merge pull request #3124 from gsd-build/fix/3050-update-backup-step-crashes-with-eacces-w
fix: make update custom-file backup resilient to EACCES
This commit is contained in:
@@ -486,10 +486,15 @@ const path = require('path');
|
||||
for (const relPath of custom_files) {
|
||||
const src = path.join(runtimeDir, relPath);
|
||||
const dst = path.join(backupDir, relPath);
|
||||
if (fs.existsSync(src)) {
|
||||
if (!fs.existsSync(src)) continue;
|
||||
|
||||
try {
|
||||
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
||||
fs.copyFileSync(src, dst);
|
||||
console.log(' Backed up: ' + relPath);
|
||||
} catch (err) {
|
||||
const code = err && err.code ? String(err.code) : 'ERROR';
|
||||
console.log(' Skipped (non-fatal): ' + relPath + ' [' + code + ']');
|
||||
}
|
||||
}
|
||||
JSEOF
|
||||
|
||||
Reference in New Issue
Block a user