1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Switch legacy execHelm to use legacy global DI for binaryPath

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-11-16 11:53:17 -05:00
parent 1aef332a7c
commit 92454f20a1

View File

@ -6,9 +6,10 @@
import { promiseExecFile } from "../../common/utils/promise-exec";
import type { ObjectEncodingOptions } from "fs";
import type { ExecFileOptions, ExecFileOptionsWithStringEncoding } from "child_process";
import { helmBinaryPath } from "../../common/vars";
import { UserStore } from "../../common/user-store";
import { isChildProcessError } from "../../common/utils";
import { getLegacyGlobalDiForExtensionApi } from "../../extensions/as-legacy-globals-for-extension-api/legacy-global-di-for-extension-api";
import helmBinaryPathInjectable from "./helm-binary-path.injectable";
/**
* ExecFile the bundled helm CLI
@ -19,6 +20,8 @@ export async function execHelm(args: string[], { encoding, ...rest }: ObjectEnco
encoding: encoding ?? "utf-8",
...rest,
};
const di = getLegacyGlobalDiForExtensionApi();
const helmBinaryPath = di.inject(helmBinaryPathInjectable);
try {
const opts = { ...options };
@ -29,7 +32,7 @@ export async function execHelm(args: string[], { encoding, ...rest }: ObjectEnco
opts.env.HTTPS_PROXY = UserStore.getInstance().httpsProxy;
}
const { stdout } = await promiseExecFile(helmBinaryPath.get(), args, opts);
const { stdout } = await promiseExecFile(helmBinaryPath, args, opts);
return stdout;
} catch (error) {