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

Commit 168f655

Browse files
committed
fix(plugins/plugin-kubectl): make sure to send helm to pty when needed
1 parent 6fcac36 commit 168f655

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

plugins/plugin-kubectl/helm/src/controller/helm/catchall.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import { isUsage, doHelp, KubeOptions } from '@kui-shell/plugin-kubectl'
2020
import doExecWithPty from './exec'
2121

2222
/** is the given string `str` the `helm` command? */
23-
const isHelm = (str: string) => /^helm$/.test(str)
23+
const isHelm = (argv: string[]) => {
24+
return /^helm$/.test(argv[0]) && argv.every(arg => !/(\\|\n|;|&)/.test(arg)) // <-- no newlines or semicolons or && or &; just send those to the base catchall handler
25+
}
2426

2527
export default (registrar: Registrar) => {
2628
if (Capabilities.inBrowser() && !Capabilities.hasProxy()) {
@@ -33,7 +35,7 @@ export default (registrar: Registrar) => {
3335
// found exceptions to the outer shell
3436
//
3537
registrar.catchall(
36-
(argv: string[]) => isHelm(argv[0]),
38+
(argv: string[]) => isHelm(argv),
3739
(args: Arguments<KubeOptions>) =>
3840
isUsage(args) || (args.argv.length === 1 && args.argv[0] === 'helm') ? doHelp('helm', args) : doExecWithPty(args),
3941
1 // priority

plugins/plugin-kubectl/helm/src/controller/helm/install.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { Arguments, Registrar } from '@kui-shell/core'
18-
import { doHelp, getNamespaceForArgv, KubeOptions } from '@kui-shell/plugin-kubectl'
18+
import { doHelp, doExecWithPty, getNamespaceForArgv, KubeOptions } from '@kui-shell/plugin-kubectl'
1919

2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
@@ -25,6 +25,8 @@ const name = /^NAME:\s+([\w-]+)/
2525
async function doInstall(args: Arguments<KubeOptions>) {
2626
if (isUsage(args, 'install')) {
2727
return doHelp('helm', args)
28+
} else if (/[\n;&]/.test(args.command)) {
29+
return doExecWithPty(args, undefined, 'helm')
2830
}
2931

3032
const response = await doExecWithStdout(args)

0 commit comments

Comments
 (0)