Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/blockcontroller/shellcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,14 @@ func (bc *ShellController) startSshShellProcNoWsh(ctx context.Context, rc *RunSh
// tags the shell and everything it starts, so the busy check can find them (busy.go)
cmdOpts.SessionEnv = map[string]string{PlainShellMarkerVar: bc.BlockId}
}
} else if bc.ControllerType == BlockController_Cmd {
// without wsh nothing else runs the command: session.Shell() would just open an idle prompt
// the trailing exec keeps the terminal open at a prompt once the command finishes
// (newlines, not ";", so a trailing comment or multi-line snippet can't swallow it)
sessionCmd = cmdStr + "\n" + `exec "${SHELL:-sh}" -l`
if cmdOpts.Cwd != "" {
sessionCmd = "cd " + utilfn.ShellQuote(cmdOpts.Cwd, false, -1) + "\n" + sessionCmd
}
}
shellProc, err := shellexec.StartRemoteShellProcNoWsh(ctx, rc.TermSize, cmdStr, cmdOpts, conn, sessionCmd)
if err != nil {
Expand Down