1
0
forked from wrenn/wrenn

fix exec cwd and env propagation

This commit is contained in:
Tasnim Kabir Sadik
2026-05-15 15:06:32 +06:00
parent c08884fa2c
commit 239a642497
8 changed files with 186 additions and 118 deletions

View File

@ -142,6 +142,8 @@ func (h *execHandler) Exec(w http.ResponseWriter, r *http.Request) {
Cmd: req.Cmd,
Args: req.Args,
TimeoutSec: req.TimeoutSec,
Envs: req.Envs,
Cwd: req.Cwd,
}))
if err != nil {
status, code, msg := agentErrToHTTP(err)

View File

@ -35,9 +35,11 @@ var upgrader = websocket.Upgrader{
// wsStartMsg is the first message the client sends to start a process.
type wsStartMsg struct {
Type string `json:"type"` // "start"
Cmd string `json:"cmd"`
Args []string `json:"args"`
Type string `json:"type"` // "start"
Cmd string `json:"cmd"`
Args []string `json:"args"`
Envs map[string]string `json:"envs"`
Cwd string `json:"cwd"`
}
// wsOutMsg is sent by the server for process events.
@ -133,6 +135,8 @@ func (h *execStreamHandler) runExecStream(ctx context.Context, conn *websocket.C
SandboxId: sandboxIDStr,
Cmd: startMsg.Cmd,
Args: startMsg.Args,
Envs: startMsg.Envs,
Cwd: startMsg.Cwd,
}))
if err != nil {
sendWSError(conn, "failed to start exec stream: "+err.Error())