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

Commit 37e23f2

Browse files
starpitk8s-ci-robot
authored andcommitted
fix(plugins/plugin-bash-like): doExecWithStdoutViaPty emits internal stack traces in headless mode
part of #7334
1 parent 3d52e56 commit 37e23f2

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,18 @@ export async function doExecWithStdoutViaPty<O extends ParsedOptions = ParsedOpt
135135
const myArgs = Object.assign({}, args, { execOptions: myExecOptions })
136136

137137
await dispatchToShell(myArgs).catch(err => {
138-
console.error(err)
139-
140138
// if the PTY emitted anything on stdout, use this as the message
141-
err.message = stdout || err.message
139+
const message = stdout || err.message
140+
141+
if (stdout && isHeadless()) {
142+
// avoid stack traces to our own code? see
143+
// https://github.com/kubernetes-sigs/kui/issues/7334
144+
console.error(message)
145+
} else {
146+
console.error(err)
147+
}
148+
149+
err.message = message
142150

143151
reject(err)
144152
})

0 commit comments

Comments
 (0)