Skip to content

Commit 7640a0e

Browse files
authoredJul 21, 2019
Merge pull request #32 from avh4/fix-upgrades
Fix "Error: EEXIST: file already exists" when upgrading
2 parents 1208bd4 + 6fda752 commit 7640a0e

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
 

‎binstall.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ function untgz(url, path, options) {
4242
reject("Error decompressing " + url + " " + error);
4343
});
4444

45-
fs.mkdirSync(path);
45+
try {
46+
fs.mkdirSync(path);
47+
} catch (error) {
48+
if (error.code !== 'EEXIST') throw error;
49+
}
4650

4751
request
4852
.get(url, function(error, response) {

‎test/binwrapTest.js

+16
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ describe("binwrap", function() {
5858
});
5959
});
6060
});
61+
62+
it("works when a previous version was installed", function() {
63+
this.timeout(60000);
64+
return exec(
65+
"(cd test_app && ./node_modules/.bin/binwrap-install darwin x64)"
66+
).then(function() {
67+
return exec(
68+
"(cd test_app && ./node_modules/.bin/binwrap-install darwin x64)"
69+
);
70+
}).then(function() {
71+
testServer.close();
72+
return exec("BINWRAP_PLATFORM=darwin BINWRAP_ARCH=x64 test_app/bin/echoMe A B C").then(function(result) {
73+
expect(result.stdout).to.equal("Me! A B C\n");
74+
});
75+
});
76+
});
6177
});
6278

6379
describe("installing with --ignore-scripts", function() {

0 commit comments

Comments
 (0)
Please sign in to comment.