mirror of https://github.com/containers/podman.git
Fix remote-client testing reports
Ensure when using remote attach --no-stdin a mock device is used to prevent stdin and not nil. This fixes issue #3009. When starting a container with the remote client, if the container is already running and the user asks to attach, we should just attach. This fixes issue #3011 Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
parent
a01c62fcbd
commit
4f2666bec0
|
|
@ -584,7 +584,10 @@ func (r *LocalRuntime) Attach(ctx context.Context, c *cliconfig.AttachValues) er
|
|||
}
|
||||
inputStream := os.Stdin
|
||||
if c.NoStdin {
|
||||
inputStream = nil
|
||||
inputStream, err = os.Open(os.DevNull)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
errChan, err := r.attach(ctx, inputStream, os.Stdout, c.InputArgs[0], false, c.DetachKeys)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,13 @@ func (i *LibpodAPI) Attach(call iopodman.VarlinkCall, name string, detachKeys st
|
|||
if err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
|
||||
state, err := ctr.State()
|
||||
if err != nil {
|
||||
return call.ReplyErrorOccurred(err.Error())
|
||||
}
|
||||
if !start && state != libpod.ContainerStateRunning {
|
||||
return call.ReplyErrorOccurred("container must be running to attach")
|
||||
}
|
||||
reader, writer, _, pw, streams := setupStreams(call)
|
||||
|
||||
go func() {
|
||||
|
|
@ -62,10 +68,10 @@ func (i *LibpodAPI) Attach(call iopodman.VarlinkCall, name string, detachKeys st
|
|||
}
|
||||
}()
|
||||
|
||||
if start {
|
||||
finalErr = startAndAttach(ctr, streams, detachKeys, resize, errChan)
|
||||
} else {
|
||||
if state == libpod.ContainerStateRunning {
|
||||
finalErr = attach(ctr, streams, detachKeys, resize, errChan)
|
||||
} else {
|
||||
finalErr = startAndAttach(ctr, streams, detachKeys, resize, errChan)
|
||||
}
|
||||
|
||||
if finalErr != libpod.ErrDetach && finalErr != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue