Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 78d360d

Browse files
committed
fix(plugins/plugin-bash-like): kubectl prereq fails
This is due to a change in bash-like's new cwd() impl
1 parent e5163dd commit 78d360d

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

plugins/plugin-bash-like/src/lib/cmds/catchall.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const debug = Debug('plugins/bash-like/cmds/catchall')
2727
*/
2828
export const dispatchToShell = async ({
2929
tab,
30+
REPL,
3031
command,
3132
argv,
3233
argvNoOptions,
@@ -53,7 +54,7 @@ export const dispatchToShell = async ({
5354
const eOptions =
5455
useRaw || execOptions.isProxied
5556
? execOptions
56-
: Object.assign({ cwd: await cwd(execOptions, tab.REPL) }, { stdout: await createOutputStream() }, execOptions)
57+
: Object.assign({ cwd: await cwd(execOptions, REPL) }, { stdout: await createOutputStream() }, execOptions)
5758

5859
const actualCommand = command.replace(/^(!|sendtopty)\s+/, '')
5960

@@ -75,7 +76,7 @@ export const dispatchToShell = async ({
7576
return response
7677
} else {
7778
const { doExec } = await import(/* webpackMode: "lazy" */ '../../pty/client')
78-
const exec = () => doExec(tab, actualCommand, argvNoOptions, parsedOptions, eOptions)
79+
const exec = () => doExec(tab, REPL, actualCommand, argvNoOptions, parsedOptions, eOptions)
7980

8081
if (useRaw) {
8182
eOptions.quiet = true

plugins/plugin-bash-like/src/pty/client.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { IDisposable, Terminal as XTerminal } from 'xterm'
2525
import {
2626
Capabilities,
2727
Tab,
28+
REPL,
2829
Abortable,
2930
FlowControllable,
3031
XtermResponse,
@@ -748,6 +749,7 @@ const getOrCreateChannel = async (
748749
cmdline: string,
749750
uuid: string,
750751
tab: Tab,
752+
repl: REPL,
751753
execOptions: ExecOptions,
752754
terminal: KuiTerminal,
753755
initOnMessage: (ws: Channel) => void,
@@ -772,7 +774,7 @@ const getOrCreateChannel = async (
772774
uuid,
773775
rows: terminal ? terminal.rows : 80,
774776
cols: terminal ? terminal.cols : 40,
775-
cwd: await cwd(execOptions, tab.REPL),
777+
cwd: await cwd(execOptions, repl),
776778
env: Object.keys(env).length > 0 && env // VERY IMPORTANT: don't send an empty process.env
777779
}
778780
debug('exec after open', msg)
@@ -826,6 +828,7 @@ const getOrCreateChannel = async (
826828
*/
827829
export const doExec = (
828830
tab: Tab,
831+
repl: REPL,
829832
cmdline: string,
830833
argvNoOptions: string[],
831834
parsedOptions: Options,
@@ -967,18 +970,25 @@ export const doExec = (
967970
//
968971
// create a channel to the underlying node-pty
969972
//
970-
const ws: Channel = await getOrCreateChannel(cmdline, ourUUID, tab, execOptions, terminal, init, focus).catch(
971-
(err: CodedError) => {
972-
if (err.code !== 503) {
973-
// don't bother complaining too much about connection refused
974-
console.error('error creating channel', err)
975-
}
976-
if (cleanUpTerminal) {
977-
cleanUpTerminal()
978-
}
979-
throw err
973+
const ws: Channel = await getOrCreateChannel(
974+
cmdline,
975+
ourUUID,
976+
tab,
977+
repl,
978+
execOptions,
979+
terminal,
980+
init,
981+
focus
982+
).catch((err: CodedError) => {
983+
if (err.code !== 503) {
984+
// don't bother complaining too much about connection refused
985+
console.error('error creating channel', err)
986+
}
987+
if (cleanUpTerminal) {
988+
cleanUpTerminal()
980989
}
981-
)
990+
throw err
991+
})
982992
if (resizer) {
983993
resizer.ws = ws
984994
}

plugins/plugin-bash-like/src/pty/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ export const doExec = (
2727
argvNoOptions: string[],
2828
parsedOptions: Options,
2929
execOptions: ExecOptions
30-
) => import('./client').then(_ => _.doExec(tab, cmdline, argvNoOptions, parsedOptions, execOptions))
30+
) => import('./client').then(_ => _.doExec(tab, tab.REPL, cmdline, argvNoOptions, parsedOptions, execOptions))

0 commit comments

Comments
 (0)