From e7e3e1382569019447476187b3694643b67735cc Mon Sep 17 00:00:00 2001 From: Jeffrey Posnick Date: Tue, 27 Jun 2017 10:16:18 -0400 Subject: [PATCH] Fixes a few bugs affecting the tests. (#92) --- package-lock.json | 12 ++++++------ src/download-manager.js | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1ff99ab..80eca1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2182,6 +2182,12 @@ "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=", "dev": true }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + }, "string_decoder": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.2.tgz", @@ -2196,12 +2202,6 @@ } } }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true - }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", diff --git a/src/download-manager.js b/src/download-manager.js index d5e00e6..7b897c0 100644 --- a/src/download-manager.js +++ b/src/download-manager.js @@ -250,7 +250,8 @@ class DownloadManager { fse.copySync( path.join(mountedPath, chromeOSXAppName), - path.join(installDir, 'chrome', release, chromeOSXAppName) + path.join(installDir, 'chrome', release, chromeOSXAppName), + {dereference: true} ); dmg.unmount(mountedPath, (err) => { @@ -267,7 +268,9 @@ class DownloadManager { } }) .then((filePath) => { - return del(filePath, {force: true}); + if (filePath) { + return del(filePath, {force: true}); + } }); } @@ -375,7 +378,8 @@ class DownloadManager { fse.copySync( path.join(mountedPath, firefoxMacApp), - path.join(installDir, 'firefox', release, firefoxMacApp) + path.join(installDir, 'firefox', release, firefoxMacApp), + {dereference: true} ); dmg.unmount(mountedPath, (err) => { @@ -392,7 +396,9 @@ class DownloadManager { throw new Error('Unable to handle downloaded file: ', downloadUrl); }) .then((filePath) => { - return del(filePath, {force: true}); + if (filePath) { + return del(filePath, {force: true}); + } }); } @@ -608,7 +614,9 @@ class DownloadManager { } }) .then((filePath) => { - return del(filePath, {force: true}); + if (filePath) { + return del(filePath, {force: true}); + } }); } }