Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Fix install retry
Browse files Browse the repository at this point in the history
  • Loading branch information
filipbudisa committed Sep 24, 2020
1 parent ec95067 commit 94d7423
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions core/compiler/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export default class Installer {
const dest = path.join(os.homedir(), '.arduino');
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });

let installPath: string | undefined;

util
.extract(file, tmp)
.then(() => {
Expand All @@ -197,7 +199,7 @@ export default class Installer {
}

const name = files[0];
const installPath = path.join(dest, name);
installPath = path.join(dest, name);

fs.copySync(path.join(tmp, name), installPath);

Expand Down Expand Up @@ -271,7 +273,12 @@ export default class Installer {
}else{
err = error;
}
callback(err);

if(installPath){
rimraf(installPath, { }, () => {
callback(err);
});
}
return;
}

Expand Down
2 changes: 1 addition & 1 deletion core/files/arduinoInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class arduinoInstall {
event.reply("installstate", { state: this.setupState });
});

ipcMain.once("install", (event, args) => {
ipcMain.on("install", (event, args) => {
this.setup(callback);
});

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"private": true,
"dependencies": {
"@grpc/proto-loader": "^0.5.2",
"@types/rimraf": "^3.0.0",
"dom-parser": "^0.1.6",
"electron-updater": "^4.2.0",
"fs-extra": "^8.1.0",
Expand Down

0 comments on commit 94d7423

Please sign in to comment.