Add Processes() to client

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-05-31 13:25:39 -07:00
parent 8ec5c30d83
commit ff54c88e99
3 changed files with 89 additions and 0 deletions

15
task.go
View File

@@ -31,6 +31,7 @@ type Task interface {
Status(context.Context) (TaskStatus, error)
Wait(context.Context) (uint32, error)
Exec(context.Context, *specs.Process, IOCreation) (Process, error)
Processes(context.Context) ([]uint32, error)
}
type Process interface {
@@ -143,3 +144,17 @@ func (t *task) Exec(ctx context.Context, spec *specs.Process, ioCreate IOCreatio
pidSync: make(chan struct{}),
}, nil
}
func (t *task) Processes(ctx context.Context) ([]uint32, error) {
response, err := t.client.TaskService().Processes(ctx, &execution.ProcessesRequest{
ContainerID: t.containerID,
})
if err != nil {
return nil, err
}
var out []uint32
for _, p := range response.Processes {
out = append(out, p.Pid)
}
return out, nil
}