Skip to content

Commit

Permalink
Unlink binary download on error properly
Browse files Browse the repository at this point in the history
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
  • Loading branch information
nevalla committed Mar 26, 2020
1 parent d7c22c8 commit 5428361
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/lens-binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as request from "request"
import logger from "./logger"
import { ensureDir, pathExists } from "fs-extra"
import * as tar from "tar"
import { userStore } from "../common/user-store"
import { globalRequestOpts} from "../common/request"

export type LensBinaryOpts = {
Expand Down Expand Up @@ -152,7 +151,7 @@ export class LensBinary {

stream.on("error", (error) => {
logger.error(error)
fs.unlink(this.path, () => {})
fs.unlink(binaryPath, () => {})
throw(error)
})
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 5428361

Please # to comment.