diff --git a/cmd/ctr/run_unix.go b/cmd/ctr/run_unix.go index ca195a82c..a2a8574ae 100644 --- a/cmd/ctr/run_unix.go +++ b/cmd/ctr/run_unix.go @@ -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) diff --git a/cmd/ctr/run_windows.go b/cmd/ctr/run_windows.go index 2ad33e5bc..b50c8dbf4 100644 --- a/cmd/ctr/run_windows.go +++ b/cmd/ctr/run_windows.go @@ -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)