Unlink binary download on error properly (#162)

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala authored and GitHub committed 2020-03-27 07:40:31 +02:00
1 parent 4e6dad53d2
commit f432d7e2c0
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) => {