Fix crash when downloading second package build

The logic to figure out which build dirs are temp dirs which need to be
freed and which are not was wrong, since it missed the non-temp

               files.pathResolve(files.pathDirname(packagePath),
                                 packageLinkTarget));

Use a more explicit way of tracking this.

(Fixed merge conflict when merging from devel.)
This commit is contained in:
David Glasser
2015-02-05 08:55:49 -08:00
parent f2f0482c69
commit 89381e98cd

View File

@@ -303,10 +303,11 @@ _.extend(exports.Tropohouse.prototype, {
buildmessage.enterJob({
title: "downloading " + packageName + "@" + version + "..."
}, function() {
var buildInputDirs = [];
var buildTempDirs = [];
// If there's already a package in the tropohouse, start with it.
if (packageLinkTarget) {
buildTempDirs.push(
buildInputDirs.push(
files.pathResolve(files.pathDirname(packageLinkFile),
packageLinkTarget));
}
@@ -315,20 +316,22 @@ _.extend(exports.Tropohouse.prototype, {
// warehouse?
_.each(buildsToDownload, function (build) {
try {
buildTempDirs.push(self._downloadBuildToTempDir(
{ packageName: packageName, version: version }, build));
var buildTempDir = self._downloadBuildToTempDir(
{ packageName: packageName, version: version }, build);
} catch (e) {
if (!(e instanceof files.OfflineError))
throw e;
buildmessage.error(e.error.message);
}
buildInputDirs.push(buildTempDir);
buildTempDirs.push(buildTempDir);
});
if (buildmessage.jobHasMessages())
return;
// We need to turn our builds into a single isopack.
var isopack = new Isopack;
_.each(buildTempDirs, function (buildTempDir, i) {
_.each(buildInputDirs, function (buildTempDir, i) {
isopack._loadUnibuildsFromPath(
packageName,
buildTempDir,