44 "bytes"
55 "errors"
66 "fmt"
7+ "github.com/covexo/devspace/pkg/util/terminal"
78 "io"
89 "net/http"
910 "os"
@@ -16,7 +17,6 @@ import (
1617 "github.com/covexo/devspace/pkg/devspace/config/configutil"
1718 "github.com/covexo/devspace/pkg/devspace/config/v1"
1819 "github.com/covexo/devspace/pkg/util/log"
19- dockerterm "github.com/docker/docker/pkg/term"
2020 k8sv1 "k8s.io/api/core/v1"
2121 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222 "k8s.io/client-go/kubernetes"
@@ -413,7 +413,7 @@ func Exec(kubectlClient *kubernetes.Clientset, pod *k8sv1.Pod, container string,
413413 SubResource ("exec" )
414414
415415 if tty {
416- t = setupTTY ()
416+ t = terminal . SetupTTY ()
417417 }
418418
419419 execRequest .VersionedParams (& k8sapi.PodExecOptions {
@@ -475,30 +475,6 @@ func Exec(kubectlClient *kubernetes.Clientset, pod *k8sv1.Pod, container string,
475475 return stdinWriter , stdoutReader , stderrReader , nil
476476}
477477
478- func setupTTY () term.TTY {
479- t := term.TTY {
480- Out : os .Stdout ,
481- In : os .Stdin ,
482- }
483-
484- if ! t .IsTerminalIn () {
485- log .Info ("Unable to use a TTY - input is not a terminal or the right kind of file" )
486-
487- return t
488- }
489-
490- // if we get to here, the user wants to attach stdin, wants a TTY, and In is a terminal, so we
491- // can safely set t.Raw to true
492- t .Raw = true
493-
494- stdin , stdout , _ := dockerterm .StdStreams ()
495-
496- t .In = stdin
497- t .Out = stdout
498-
499- return t
500- }
501-
502478//ExecBuffered executes a command for kubernetes and returns the output and error buffers
503479func ExecBuffered (kubectlClient * kubernetes.Clientset , pod * k8sv1.Pod , container string , command []string ) ([]byte , []byte , error ) {
504480 _ , stdout , stderr , execErr := Exec (kubectlClient , pod , container , command , false , nil )
0 commit comments