Update GRPC for consistency
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
34
process.go
34
process.go
@@ -3,10 +3,10 @@ package containerd
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
taskapi "github.com/containerd/containerd/api/types/task"
|
||||
protobuf "github.com/gogo/protobuf/types"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
@@ -38,7 +38,7 @@ func (p *process) Start(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
request := &execution.ExecRequest{
|
||||
request := &execution.ExecProcessRequest{
|
||||
ContainerID: p.task.containerID,
|
||||
Terminal: p.io.Terminal,
|
||||
Stdin: p.io.Stdin,
|
||||
@@ -70,30 +70,18 @@ func (p *process) Kill(ctx context.Context, s syscall.Signal) error {
|
||||
}
|
||||
|
||||
func (p *process) Wait(ctx context.Context) (uint32, error) {
|
||||
events, err := p.task.client.TaskService().Events(ctx, &execution.EventsRequest{})
|
||||
if err != nil {
|
||||
return UnknownExitStatus, err
|
||||
}
|
||||
<-p.pidSync
|
||||
for {
|
||||
e, err := events.Recv()
|
||||
if err != nil {
|
||||
return UnknownExitStatus, err
|
||||
}
|
||||
if e.Type != taskapi.Event_EXIT {
|
||||
continue
|
||||
}
|
||||
if e.ID == p.task.containerID && e.Pid == p.pid {
|
||||
return e.ExitStatus, nil
|
||||
}
|
||||
}
|
||||
return 255, fmt.Errorf("not implemented")
|
||||
}
|
||||
|
||||
func (p *process) CloseStdin(ctx context.Context) error {
|
||||
_, err := p.task.client.TaskService().CloseStdin(ctx, &execution.CloseStdinRequest{
|
||||
func (p *process) CloseIO(ctx context.Context, opts ...IOCloserOpts) error {
|
||||
r := &execution.CloseIORequest{
|
||||
ContainerID: p.task.containerID,
|
||||
Pid: p.pid,
|
||||
})
|
||||
}
|
||||
for _, o := range opts {
|
||||
o(r)
|
||||
}
|
||||
_, err := p.task.client.TaskService().CloseIO(ctx, r)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -102,7 +90,7 @@ func (p *process) IO() *IO {
|
||||
}
|
||||
|
||||
func (p *process) Resize(ctx context.Context, w, h uint32) error {
|
||||
_, err := p.task.client.TaskService().Pty(ctx, &execution.PtyRequest{
|
||||
_, err := p.task.client.TaskService().ResizePty(ctx, &execution.ResizePtyRequest{
|
||||
ContainerID: p.task.containerID,
|
||||
Width: w,
|
||||
Height: h,
|
||||
|
Reference in New Issue
Block a user