From 89381e98cd45f5b70cb606f6464ec36cf5af8376 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Thu, 5 Feb 2015 08:55:49 -0800 Subject: [PATCH] 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.) --- tools/tropohouse.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/tropohouse.js b/tools/tropohouse.js index 68a228095e..96dd3b8cc9 100644 --- a/tools/tropohouse.js +++ b/tools/tropohouse.js @@ -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,