Skip to content

Commit

Permalink
chore: container.exec support AttachStdin
Browse files Browse the repository at this point in the history
  • Loading branch information
whatwewant committed Aug 6, 2024
1 parent 8924c97 commit f7688b9
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions container/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ type ExecOptions struct {
Detach bool
Tty bool
Cmd []string
// //
// Stdin io.Reader
// Stdout io.WriteCloser
// Stderr io.WriteCloser
//
AttachStdin bool
}

type ExecTerm struct {
Expand All @@ -27,16 +25,14 @@ type ExecTerm struct {
// Exec executes a command inside a container.
func (c *container) Exec(ctx context.Context, id string, opts ...func(opt *ExecOptions)) (*ExecTerm, error) {
opt := &ExecOptions{
// Stdin: os.Stdin,
// Stdout: os.Stdout,
// Stderr: os.Stderr,
AttachStdin: true,
}
for _, o := range opts {
o(opt)
}

response, err := c.client.ContainerExecCreate(ctx, id, dc.ExecOptions{
AttachStdin: true,
AttachStdin: opt.AttachStdin,
AttachStdout: true,
AttachStderr: true,
Tty: opt.Tty,
Expand Down

0 comments on commit f7688b9

Please sign in to comment.