Add Resize pty support to client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
00734ab04a
commit
e022cf3ad0
14
process.go
14
process.go
@ -96,3 +96,17 @@ func (p *process) CloseStdin(ctx context.Context) error {
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *process) IO() *IO {
|
||||
return p.io
|
||||
}
|
||||
|
||||
func (p *process) Resize(ctx context.Context, w, h uint32) error {
|
||||
_, err := p.task.client.TaskService().Pty(ctx, &execution.PtyRequest{
|
||||
ContainerID: p.task.containerID,
|
||||
Width: w,
|
||||
Height: h,
|
||||
Pid: p.pid,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
13
task.go
13
task.go
@ -33,6 +33,7 @@ type Task interface {
|
||||
Exec(context.Context, *specs.Process, IOCreation) (Process, error)
|
||||
Processes(context.Context) ([]uint32, error)
|
||||
CloseStdin(context.Context) error
|
||||
Resize(ctx context.Context, w, h uint32) error
|
||||
IO() *IO
|
||||
}
|
||||
|
||||
@ -42,6 +43,8 @@ type Process interface {
|
||||
Kill(context.Context, syscall.Signal) error
|
||||
Wait(context.Context) (uint32, error)
|
||||
CloseStdin(context.Context) error
|
||||
Resize(ctx context.Context, w, h uint32) error
|
||||
IO() *IO
|
||||
}
|
||||
|
||||
var _ = (Task)(&task{})
|
||||
@ -173,3 +176,13 @@ func (t *task) CloseStdin(ctx context.Context) error {
|
||||
func (t *task) IO() *IO {
|
||||
return t.io
|
||||
}
|
||||
|
||||
func (t *task) Resize(ctx context.Context, w, h uint32) error {
|
||||
_, err := t.client.TaskService().Pty(ctx, &execution.PtyRequest{
|
||||
ContainerID: t.containerID,
|
||||
Width: w,
|
||||
Height: h,
|
||||
Pid: t.pid,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user