Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 576468e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions tools/project-context.js
Expand Up @@ -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.
Expand All @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 576468e

Please sign in to comment.