fix: sshCmd closure bug + error display

CRITICAL BUG: sshConnectCmd wrapped tea.ExecProcess inside an extra
closure, so Bubble Tea never executed the SSH process — Enter appeared
to do nothing.

Fix:
- sshConnectCmd now returns tea.ExecProcess directly (no extra closure)
- tea.ExecProcess handles all process lifecycle (start, PTY, exit)
- sshExitMsg errors are shown in host list view (ErrorStyle)
- Error routed via Model.Error → HostListTab.err → View()
This commit is contained in:
swanadiva
2026-06-23 15:50:20 +07:00
parent 79f3917a66
commit daa20ac72b
3 changed files with 104 additions and 80 deletions
+11
View File
@@ -65,6 +65,9 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, sshConnectCmd(msg.host, m.dataDir)
case sshExitMsg:
if msg.err != nil {
m.Error = msg.err
}
return m, nil
case openHostFormMsg:
@@ -203,6 +206,14 @@ func (m *Model) View() string {
return "No tabs open. Press 'q' to quit.\n"
}
// Pass error to host list tab for display
if m.Error != nil {
if ht := FindHostListTab(m.tabs.tabs); ht != nil {
ht.err = m.Error
}
m.Error = nil
}
return m.tabs.View()
}