MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / Exec

Method Exec

cli/pkg/common/docker.go:188–200  ·  view source on GitHub ↗
(ctx context.Context, container string, chdir string, cmd []string, env []string)

Source from the content-addressed store, hash-verified

186}
187
188func (d Docker) Exec(ctx context.Context, container string, chdir string, cmd []string, env []string) (string, error) {
189 id, err := d.client.ContainerExecCreate(ctx, container, types.ExecConfig{Tty: true, WorkingDir: chdir, Cmd: cmd, Env: env, AttachStderr: true, AttachStdout: true})
190 if err != nil {
191 return "", err
192 }
193 resp, err := d.client.ContainerExecAttach(ctx, id.ID, types.ExecStartCheck{})
194 if err != nil {
195 return "", err
196 }
197 buf := new(bytes.Buffer)
198 buf.ReadFrom(resp.Reader)
199 return buf.String(), err
200}
201
202func (d Docker) Restart(ctx context.Context, container string) error {
203 _ = d.Stop(ctx, container)

Callers 12

GitConfigFunction · 0.80
LocalContainerGitSetFunction · 0.80
RemoveK8sFunction · 0.80
InsertOrUpdateK8sInfoFunction · 0.80
createDataTablesFunction · 0.80
InsertOrUpdateWorkspaceFunction · 0.80
RemoveWorkspaceFunction · 0.80
RemoveRemoteFunction · 0.80
InsertOrUpdateRemoteFunction · 0.80
LocalNewFunction · 0.80

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected