Skip to content

Commit

Permalink
fix(plugins/plugin-kubectl): for now, send kubectl ... $(...) command…
Browse files Browse the repository at this point in the history
… lines to pty

At some point, we could get more sophisticated, and expand the $(...) subprocess executions, and still handle the rest in kui.
  • Loading branch information
starpit committed Dec 28, 2021
1 parent 555d803 commit 374fa5b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/plugin-kubectl/src/controller/kubectl/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ export function doExecWithStdout<O extends KubeOptions>(
* required? That is, versus a plain nodejs spawn/exec.
*
*/
export function reallyNeedsPty({ argvNoOptions }: Pick<Arguments, 'argvNoOptions'>) {
return argvNoOptions.includes('|') || argvNoOptions.includes('>') || argvNoOptions.includes('>>')
export function reallyNeedsPty({ argvNoOptions, parsedOptions }: Pick<Arguments, 'argvNoOptions' | 'parsedOptions'>) {
const test1 = (_: string) => /(\$\(|`)/.test(_) // subprocess execution?
const test2 = (_: string) => /^\s*(\||>|>>)\s*$/.test(_) || test1(_)
return !!argvNoOptions.find(test2) || !!Object.values(parsedOptions).find(test1)
}

/**
Expand Down

0 comments on commit 374fa5b

Please sign in to comment.