Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/spf13/cobra"
"io"
"os"
"os/signal"
"syscall"

"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/remotecommand"
Expand Down Expand Up @@ -76,20 +74,6 @@ func (t *terminalSizeQueue) Next() *remotecommand.TerminalSize {
return &size
}

func monitorTerminalResize(sizeQueue chan remotecommand.TerminalSize) {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGWINCH)
defer signal.Stop(ch)

for range ch {
if width, height, err := term.GetSize(int(os.Stdin.Fd())); err == nil {
sizeQueue <- remotecommand.TerminalSize{
Width: uint16(width), Height: uint16(height),
}
}
}
}

func (sv *dshCmd) execPod(
kcontext string, namespace string, ds string, nodeName string,
container string, stdin bool, tty bool, cmd []string,
Expand Down
26 changes: 26 additions & 0 deletions cmd/resize_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// +build !windows

package cmd

import (
"os"
"os/signal"
"syscall"

"golang.org/x/term"
"k8s.io/client-go/tools/remotecommand"
)

func monitorTerminalResize(sizeQueue chan remotecommand.TerminalSize) {
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGWINCH)
defer signal.Stop(ch)

for range ch {
if width, height, err := term.GetSize(int(os.Stdin.Fd())); err == nil {
sizeQueue <- remotecommand.TerminalSize{
Width: uint16(width), Height: uint16(height),
}
}
}
}
11 changes: 11 additions & 0 deletions cmd/resize_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build windows

package cmd

import (
"k8s.io/client-go/tools/remotecommand"
)

func monitorTerminalResize(sizeQueue chan remotecommand.TerminalSize) {
// no idea what to do for windows, so we'll ignore it for now
}