1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/helm/exec-helm/exec-helm.injectable.ts
Sebastian Malton 3456e5f21d Fix crash when upgrading helm releases
- Fixes not being able to upgrade helm releases as well.

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-11-22 11:02:21 -05:00

31 lines
1.1 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import type { ExecFileException } from "child_process";
import execFileInjectable from "../../../common/fs/exec-file.injectable";
import type { AsyncResult } from "../../../common/utils/async-result";
import helmBinaryPathInjectable from "../helm-binary-path.injectable";
import execHelmEnvInjectable from "./exec-env.injectable";
export type ExecHelm = (args: string[]) => Promise<AsyncResult<string, ExecFileException & { stderr: string }>>;
const execHelmInjectable = getInjectable({
id: "exec-helm",
instantiate: (di): ExecHelm => {
const execFile = di.inject(execFileInjectable);
const execHelmEnv = di.inject(execHelmEnvInjectable);
const helmBinaryPath = di.inject(helmBinaryPathInjectable);
return async (args) => execFile(helmBinaryPath, args, {
maxBuffer: 32 * 1024 * 1024 * 1024, // 32 MiB
env: execHelmEnv.get(),
});
},
});
export default execHelmInjectable;