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:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user