Add Processes() to client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
15
task.go
15
task.go
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user