Ensure ConsoleSize is not nil

Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
Darren Stahl 2017-08-30 16:34:20 -07:00
parent 0baecaa7cf
commit 04c6bf42e2

View File

@ -53,6 +53,9 @@ func WithImageConfig(i Image) SpecOpts {
func WithTTY(width, height int) SpecOpts {
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
s.Process.Terminal = true
if s.Process.ConsoleSize == nil {
s.Process.ConsoleSize = &specs.Box{}
}
s.Process.ConsoleSize.Width = uint(width)
s.Process.ConsoleSize.Height = uint(height)
return nil