ssh: say why when there is no shell to run
CI / test (push) Successful in 3m34s
Release / release (push) Successful in 5m4s

The published container image has no shell, so a session used to end at once with
nothing printed for a command. It now explains that, and what to do about it,
and exits with status 127.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
VeillaxandClaude Sonnet 5.5 committed 2026-10-31 02:04:28 -06:00
1 parent a2403ecf9d
commit 79bd4d8646
2 files changed
+37

No files matched your search

+8
View File
@@ -25,6 +25,14 @@ func run(ch ssh.Channel, cmd string, p *ptyReq, win <-chan [2]uint32) int {
if shell == "" {
shell = "/bin/sh"
}
// Without this the client sees only a session that ends at once. The container image Bamboo is
// published in contains no shell at all, so say so, and what to do about it.
if _, err := exec.LookPath(shell); err != nil {
fmt.Fprintf(ch.Stderr(), "bamboo: there is no shell to run (%v).\r\n"+
"The Bamboo container image has none, and a shell in a container is not a shell on the machine. "+
"Run Bamboo directly on the machine (for example with its systemd unit) to get one, or set SHELL to a shell that exists.\r\n", err)
return 127
}
var c *exec.Cmd
if cmd == "" {
c = exec.Command(shell, "-l")