From 01a5ddd782ef80b63592311305aa79c123c85df3 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Wed, 20 Jul 2016 20:08:43 -0700 Subject: [PATCH] Not to use SetWinsize in windows --- pkg/util/term/resize.go | 5 ----- pkg/util/term/setsize.go | 28 ++++++++++++++++++++++++++++ pkg/util/term/setsize_unsupported.go | 24 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 pkg/util/term/setsize.go create mode 100644 pkg/util/term/setsize_unsupported.go diff --git a/pkg/util/term/resize.go b/pkg/util/term/resize.go index 83b01e54124..3d78c866419 100644 --- a/pkg/util/term/resize.go +++ b/pkg/util/term/resize.go @@ -50,11 +50,6 @@ func GetSize(fd uintptr) *Size { return &Size{Width: winsize.Width, Height: winsize.Height} } -// SetSize sets the terminal size associated with fd. -func SetSize(fd uintptr, size Size) error { - return term.SetWinsize(fd, &term.Winsize{Height: size.Height, Width: size.Width}) -} - // MonitorSize monitors the terminal's size. It returns a TerminalSizeQueue primed with // initialSizes, or nil if there's no TTY present. func (t *TTY) MonitorSize(initialSizes ...*Size) TerminalSizeQueue { diff --git a/pkg/util/term/setsize.go b/pkg/util/term/setsize.go new file mode 100644 index 00000000000..944d4e5ab67 --- /dev/null +++ b/pkg/util/term/setsize.go @@ -0,0 +1,28 @@ +// +build !windows + +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package term + +import ( + "github.com/docker/docker/pkg/term" +) + +// SetSize sets the terminal size associated with fd. +func SetSize(fd uintptr, size Size) error { + return term.SetWinsize(fd, &term.Winsize{Height: size.Height, Width: size.Width}) +} diff --git a/pkg/util/term/setsize_unsupported.go b/pkg/util/term/setsize_unsupported.go new file mode 100644 index 00000000000..dd3de3126b3 --- /dev/null +++ b/pkg/util/term/setsize_unsupported.go @@ -0,0 +1,24 @@ +// +build windows + +/* +Copyright 2016 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package term + +func SetSize(fd uintptr, size Size) error { + // NOP + return nil +}