shell: restore detach field for autonomous background processes
Re-adds the detach boolean to the shell tool args. When true, the
process is immediately backgrounded and its PID returned. This was
removed in the simplification commit 2c36c02 but is needed for
long-running commands (builds, servers, etc).
This commit is contained in:
parent
12e3338b69
commit
0e1c0f199d
|
|
@ -143,6 +143,7 @@ func dispatchShell(ctx context.Context, e *Server, args json.RawMessage) (string
|
|||
Timeout int `json:"timeout"`
|
||||
Sandbox string `json:"sandbox"`
|
||||
Elevated bool `json:"elevated"`
|
||||
Detach bool `json:"detach"`
|
||||
}
|
||||
if err := json.Unmarshal(args, &a); err != nil {
|
||||
return "", fmt.Errorf("shell: bad args: %w", err)
|
||||
|
|
@ -158,13 +159,13 @@ func dispatchShell(ctx context.Context, e *Server, args json.RawMessage) (string
|
|||
e.wdMu.RLock()
|
||||
workDir := e.cwd
|
||||
e.wdMu.RUnlock()
|
||||
return e.executeElevated(ctx, a.Cmd, workDir, timeout)
|
||||
return e.executeElevated(ctx, a.Cmd, workDir, timeout, a.Detach)
|
||||
}
|
||||
sandboxName := a.Sandbox
|
||||
if sandboxName == "" {
|
||||
sandboxName = "default"
|
||||
}
|
||||
return e.executeWithStdin(ctx, a.Cmd, "bash", timeout, sandboxName, false, "")
|
||||
return e.executeWithStdin(ctx, a.Cmd, "bash", timeout, sandboxName, false, "", a.Detach)
|
||||
}
|
||||
|
||||
// dispatchToolList lists all available tools from the global registry.
|
||||
|
|
|
|||
Reference in New Issue