mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix Kubectl.downloadKubectl() (#4674)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
14b30d84a1
commit
39beca0639
@ -35,6 +35,7 @@ import { AppPaths } from "../common/app-paths";
|
||||
import got from "got/dist/source";
|
||||
import { promisify } from "util";
|
||||
import stream from "stream";
|
||||
import { noop } from "../renderer/utils";
|
||||
|
||||
const bundledVersion = getBundledKubectlVersion();
|
||||
const kubectlMap: Map<string, string> = new Map([
|
||||
@ -315,8 +316,14 @@ export class Kubectl {
|
||||
const fileWriteStream = fs.createWriteStream(this.path, { mode: 0o755 });
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
try {
|
||||
await pipeline(downloadStream, fileWriteStream);
|
||||
await fs.promises.chmod(this.path, 0o755);
|
||||
logger.debug("kubectl binary download finished");
|
||||
} catch (error) {
|
||||
await fs.promises.unlink(this.path).catch(noop);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
protected async writeInitScripts() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user