Terminal: show the shell's error output, so a missing shell is explained
CI / test (push) Successful in 6m9s
Release / release (push) Successful in 5m54s

The shell's stderr was discarded, so a shell that could not start looked like an
immediate disconnect. It now goes to the terminal like other output, followed by
the exit code. An end-to-end test covers a machine with no shell. Builds against
Bamboo v0.1.10, which says why when there is no shell to run.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
VeillaxandClaude Sonnet 5.5 committed 2026-10-31 02:05:48 -06:00
1 parent 35d4000bc4
commit 7481b2d01c
4 files changed
+43 -3

No files matched your search

+13
View File
@@ -360,6 +360,9 @@ func (s *Server) runTerminal(ws *websocket.Conn, c *orgCtx, siteID string, cols,
problem(err.Error())
return
}
// What the shell writes to its error output (including why it could not start) goes to the
// terminal like everything else, instead of being thrown away.
sess.Stderr = termWriter(func(p []byte) error { return send(termFrame{data: append([]byte(nil), p...)}) })
if err := sess.Shell(); err != nil {
problem(fmt.Sprintf("Couldn't start a shell: %v", err))
return
@@ -566,3 +569,13 @@ func clipText(s string, n int) string {
}
return s
}
// termWriter sends what is written to it to the browser as terminal output.
type termWriter func(p []byte) error
func (w termWriter) Write(p []byte) (int, error) {
if err := w(p); err != nil {
return 0, err
}
return len(p), nil
}