Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,25 +311,25 @@ export class KubeConfig {
}
if (process.platform === 'win32' && shelljs.which('wsl.exe')) {
try {
const envKubeconfigPathResult = execa.sync('wsl.exe', ['bash', '-ic', 'printenv KUBECONFIG']);
const envKubeconfigPathResult = execa.sync('wsl.exe', ['bash', '-c', 'printenv KUBECONFIG']);
if (envKubeconfigPathResult.exitCode === 0 && envKubeconfigPathResult.stdout.length > 0) {
const result = execa.sync('wsl.exe', ['cat', envKubeconfigPathResult.stdout]);
if (result.exitCode === 0) {
this.loadFromString(result.stdout, opts);
return;
}
if (result.exitCode === 0) {
this.loadFromString(result.stdout, opts);
return;
}
}
} catch (err) {
// Falling back to default kubeconfig
}
try {
const result = execa.sync('wsl.exe', ['cat', '~/.kube/config']);
if (result.exitCode === 0) {
this.loadFromString(result.stdout, opts);
const configResult = execa.sync('wsl.exe', ['cat', '~/.kube/config']);
if (configResult.exitCode === 0) {
this.loadFromString(configResult.stdout, opts);
const result = execa.sync('wsl.exe', ['wslpath', '-w', '~/.kube']);
if (result.exitCode === 0) {
this.makePathsAbsolute(result.stdout);
}
return;
}
} catch (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Exec {
* @param {boolean} tty - Should the command execute in a TTY enabled session.
* @param {(V1Status) => void} statusCallback -
* A callback to received the status (e.g. exit code) from the command, optional.
* @return {string} This is the result
* @return {Promise<WebSocket>} A promise that will return the web socket created for this command.
*/
public async exec(
namespace: string,
Expand Down