Merge pull request #713 from mlaventure/windows-runtime

Windows Pty and CloseStdin
This commit is contained in:
Michael Crosby
2017-04-12 11:36:54 -07:00
committed by GitHub
13 changed files with 662 additions and 537 deletions

View File

@@ -5,11 +5,8 @@ import (
"encoding/json"
"fmt"
"os"
"os/signal"
"runtime"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -196,39 +193,3 @@ var runCommand = cli.Command{
return nil
},
}
func handleConsoleResize(ctx gocontext.Context, service execution.ContainerServiceClient, id string, pid uint32, con console.Console) error {
// do an initial resize of the console
size, err := con.Size()
if err != nil {
return err
}
if _, err := service.Pty(ctx, &execution.PtyRequest{
ID: id,
Pid: pid,
Width: uint32(size.Width),
Height: uint32(size.Height),
}); err != nil {
return err
}
s := make(chan os.Signal, 16)
signal.Notify(s, unix.SIGWINCH)
go func() {
for range s {
size, err := con.Size()
if err != nil {
logrus.WithError(err).Error("get pty size")
continue
}
if _, err := service.Pty(ctx, &execution.PtyRequest{
ID: id,
Pid: pid,
Width: uint32(size.Width),
Height: uint32(size.Height),
}); err != nil {
logrus.WithError(err).Error("resize pty")
}
}
}()
return nil
}