diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-04-12 12:26:51 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-13 18:43:44 +0000 |
commit | 8d7635b1ac3eaea83fcf481994294eb137110e96 (patch) | |
tree | 9b78bbbeb9b33005c2f29b4fc248d3e7b2ddbf16 /libpod/container_api.go | |
parent | 6609d555f75568bb4f1394736a3e3b31e5f0d355 (diff) | |
download | podman-8d7635b1ac3eaea83fcf481994294eb137110e96.tar.gz podman-8d7635b1ac3eaea83fcf481994294eb137110e96.tar.bz2 podman-8d7635b1ac3eaea83fcf481994294eb137110e96.zip |
Change attach to accept a struct containing streams
Comparing Go interfaces, like io.Reader, to nil does not work. As
such, we need to include a bool with each stream telling whether
to attach to it.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #608
Approved by: baude
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r-- | libpod/container_api.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index fb6c70fd0..2d5c2bef3 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -1,7 +1,6 @@ package libpod import ( - "io" "io/ioutil" "os" "strconv" @@ -125,7 +124,7 @@ func (c *Container) Start() (err error) { // attach call. // The channel will be closed automatically after the result of attach has been // sent -func (c *Container) StartAndAttach(outputStream, errorStream io.WriteCloser, inputStream io.Reader, keys string, resize <-chan remotecommand.TerminalSize) (attachResChan <-chan error, err error) { +func (c *Container) StartAndAttach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize) (attachResChan <-chan error, err error) { if !c.locked { c.lock.Lock() defer c.lock.Unlock() @@ -178,7 +177,7 @@ func (c *Container) StartAndAttach(outputStream, errorStream io.WriteCloser, inp // Attach to the container before starting it go func() { - if err := c.attach(outputStream, errorStream, inputStream, keys, resize); err != nil { + if err := c.attach(streams, keys, resize); err != nil { attachChan <- err } close(attachChan) @@ -406,7 +405,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e } // Attach attaches to a container -func (c *Container) Attach(outputStream, errorStream io.WriteCloser, inputStream io.Reader, keys string, resize <-chan remotecommand.TerminalSize) error { +func (c *Container) Attach(streams *AttachStreams, keys string, resize <-chan remotecommand.TerminalSize) error { if !c.locked { c.lock.Lock() if err := c.syncContainer(); err != nil { @@ -421,7 +420,7 @@ func (c *Container) Attach(outputStream, errorStream io.WriteCloser, inputStream return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created or running containers") } - return c.attach(outputStream, errorStream, inputStream, keys, resize) + return c.attach(streams, keys, resize) } // Mount mounts a container's filesystem on the host |