Permalink
Browse files

Handle more errors in ensureDevBundleLink.

If a developer tried to `meteor update` a project whose `.meteor/release`
file corresponded to a version of `meteor-tool` that no longer exists in
`~/.meteor/packages/meteor-tool`, this code would throw an ENOENT error.
This could be fixed by running `meteor update --release <old release>`
first, but that kind of workaround shouldn't be necessary when updating
Meteor to the latest version.
  • Loading branch information...
benjamn committed Jul 17, 2016
1 parent 23a2a45 commit 576468eae8d8dd7c1fe2fa381ac51dee5cb792cd
Showing with 14 additions and 7 deletions.
  1. +14 −7 tools/project-context.js
@@ -1399,7 +1399,12 @@ _.extend(exports.ReleaseFile.prototype, {
}
}
return files.realpath(devBundle);
try {
return files.realpath(devBundle);
} catch (e) {
if (e.code !== "ENOENT") throw e;
return null;
}
},
// Make a symlink from .meteor/local/dev_bundle to the actual dev_bundle.
@@ -1422,9 +1427,10 @@ _.extend(exports.ReleaseFile.prototype, {
return;
}
files.mkdir_p(localDir);
const newTarget = this.getDevBundle();
if (! newTarget) {
return;
}
try {
const oldOSPath = readLink(devBundleLink);
@@ -1435,15 +1441,16 @@ _.extend(exports.ReleaseFile.prototype, {
return;
}
files.mkdir_p(localDir);
makeLink(newTarget, devBundleLink);
} catch (e) {
if (e.code !== "ENOENT") {
// It's ok if files.realpath(devBundleLink) failed because the
// devBundleLink file does not exist.
// It's ok if the above commands failed because the target path
// did not exist, but other errors should not be silenced.
throw e;
}
}
makeLink(newTarget, devBundleLink);
},
write: function (releaseName) {

0 comments on commit 576468e

Please sign in to comment.