mirror of
https://github.com/skoelle/kctl-tui.git
synced 2026-09-17 20:10:24 +00:00
fix: avoid confusing tmux message in wt mode
Use c.Start() instead of tea.ExecProcess in startWtSession() to prevent tmux session closed message from appearing in the main window.
This commit is contained in:
@@ -335,6 +335,8 @@ func (m *fullModel) startTmuxSessionTmux() tea.Cmd {
|
|||||||
|
|
||||||
// startWtSession creates the session using Windows Terminal's native
|
// startWtSession creates the session using Windows Terminal's native
|
||||||
// split-pane feature. This avoids the psmux focus-freeze issue on Windows.
|
// split-pane feature. This avoids the psmux focus-freeze issue on Windows.
|
||||||
|
// Note: In Windows Terminal, -H (horizontal) stacks panes top/bottom,
|
||||||
|
// while -V (vertical) places them side by side — opposite of tmux.
|
||||||
func (m *fullModel) startWtSession() tea.Cmd {
|
func (m *fullModel) startWtSession() tea.Cmd {
|
||||||
selfPath, err := os.Executable()
|
selfPath, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -351,20 +353,19 @@ func (m *fullModel) startWtSession() tea.Cmd {
|
|||||||
kubeexec.VerboseLog("[debug] panelCmd=%s\n", panelCmd)
|
kubeexec.VerboseLog("[debug] panelCmd=%s\n", panelCmd)
|
||||||
kubeexec.VerboseLog("[debug] k9sCmdA=%s\n", k9sCmdA)
|
kubeexec.VerboseLog("[debug] k9sCmdA=%s\n", k9sCmdA)
|
||||||
|
|
||||||
args := []string{"new-tab", panelCmd, ";", "split-pane", "-V", k9sCmdA}
|
wtCmd := fmt.Sprintf("wt new-tab %s ; split-pane -H %s", panelCmd, k9sCmdA)
|
||||||
|
|
||||||
if len(m.cfg.Envs) > 1 {
|
if len(m.cfg.Envs) > 1 {
|
||||||
envB := m.cfg.Envs[1]
|
envB := m.cfg.Envs[1]
|
||||||
ctxB := m.cfg.ResolveContext(envB, m.selectedContext)
|
ctxB := m.cfg.ResolveContext(envB, m.selectedContext)
|
||||||
k9sCmdB := fmt.Sprintf("k9s --context %s --namespace %s --command pods", ctxB, m.selectedNamespace)
|
k9sCmdB := fmt.Sprintf("k9s --context %s --namespace %s --command pods", ctxB, m.selectedNamespace)
|
||||||
kubeexec.VerboseLog("[debug] k9sCmdB=%s\n", k9sCmdB)
|
kubeexec.VerboseLog("[debug] k9sCmdB=%s\n", k9sCmdB)
|
||||||
args = append(args, ";", "split-pane", "-V", k9sCmdB)
|
wtCmd += fmt.Sprintf(" ; split-pane -H %s", k9sCmdB)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := exec.Command("wt", args...)
|
c := exec.Command("cmd", "/c", wtCmd)
|
||||||
return tea.ExecProcess(c, func(err error) tea.Msg {
|
_ = c.Start()
|
||||||
return tmuxDoneMsg{err: err}
|
return nil
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *fullModel) View() string {
|
func (m *fullModel) View() string {
|
||||||
|
|||||||
Reference in New Issue
Block a user