Unlink binary download on error properly (#162)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
Signed-off-by: Cody Belcher <cody.t.belcher@gmail.com>
This commit is contained in:
Lauri Nevala authored and Cody Belcher committed 2020-04-16 11:23:38 -05:00
1 parent 0e09f05daf
commit 1c2dc57842
1 file changed
+1 -2
+1 -2
View File
@@ -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 = {
@@ -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) => {