fix(k8s): PodExecTerminal error msg 字段对齐 + command 参数传递

- PodExecTerminal 传 shell 作为 command 到 WS URL
- 去掉发送 shell\r 的旧行为(K8s exec URL 已含 command)
- error 消息检查 msg.data 字段(与后端 WSMessage.Data 对齐)
- 已验证: WebSocket exec 端到端可用 (id 命令在 argocd pod 成功执行)
This commit is contained in:
attacker committed 2026-06-23 02:27:43 +08:00
1 parent 9ab7572b8e
commit 174382ff81
2 files changed
+11 -6

No files matched your search

@@ -130,7 +130,8 @@ export function PodExecTerminal({
} else if (msg.status === 1) {
// 服务端 resize 确认,忽略
} else if (msg.status === 2 || msg.error) {
term.write(`\r\n\x1b[31m${msg.message || msg.error || '执行错误'}\x1b[0m\r\n`);
const errMsg = msg.data || msg.message || msg.error || '执行错误';
term.write(errMsg.includes('\\x1b') ? errMsg : `\\r\\n\\x1b[31m${errMsg}\\x1b[0m\\r\\n`);
}
} catch {
if (typeof event.data === 'string') term.write(event.data);