Skip to content

Commit 63a8a9d

Browse files
authored
Merge pull request #668 from rancher-sandbox/set-context
Use resources.executable to locate kubectl instead of using a relative path
2 parents 9c37814 + 5984b93 commit 63a8a9d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/k8s-engine/kubectl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import childProcess, { spawn } from 'child_process';
44
import os from 'os';
55
import process from 'process';
6+
import resources from '@/resources';
67

78
// The K8s JS library will get the current context but does not have the ability
89
// to save the context. The current version of the package targets k8s 1.18 and
@@ -13,7 +14,7 @@ export function setCurrentContext(cxt: string, exitfunc: (code: number | null, s
1314

1415
opts.env = { ...process.env };
1516

16-
const bat = spawn(`./resources/${ os.platform() }/bin/kubectl`, ['config', 'use-context', cxt], opts);
17+
const bat = spawn(resources.executable('kubectl'), ['config', 'use-context', cxt], opts);
1718

1819
// TODO: For data toggle this based on a debug mode
1920
bat.stdout?.on('data', (data) => {

0 commit comments

Comments
 (0)