Merge pull request #1676 from AkihiroSuda/null-io-fix

ctr: error if tty && nullIO
This commit is contained in:
Michael Crosby 2017-10-30 10:10:22 -04:00 committed by GitHub
commit b93bd0cfec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cmd/ctr/commands"
specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@ -122,6 +123,9 @@ func newTask(ctx gocontext.Context, client *containerd.Client, container contain
io = containerd.StdioTerminal
}
if nullIO {
if tty {
return nil, errors.New("tty and null-io cannot be used together")
}
io = containerd.NullIO
}
return container.NewTask(ctx, io)

View File

@ -124,6 +124,9 @@ func newTask(ctx gocontext.Context, client *containerd.Client, container contain
io = containerd.StdioTerminal
}
if nullIO {
if tty {
return nil, errors.New("tty and null-io cannot be used together")
}
io = containerd.NullIO
}
return container.NewTask(ctx, io)