ListPids returns process ID and other info

Signed-off-by: Jess <jessica.valarezo@docker.com>
This commit is contained in:
Jess
2017-10-10 22:57:15 +00:00
parent 72bb45ac46
commit 061c719209
18 changed files with 1118 additions and 405 deletions

View File

@@ -172,14 +172,20 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt
}
// Pids returns all system level process ids running inside the task
func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
func (t *Task) Pids(ctx context.Context) ([]runtime.ProcessInfo, error) {
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{
ID: t.id,
})
if err != nil {
return nil, errdefs.FromGRPC(err)
}
return resp.Pids, nil
var processList []runtime.ProcessInfo
for _, p := range resp.Processes {
processList = append(processList, runtime.ProcessInfo{
Pid: p.Pid,
})
}
return processList, nil
}
// ResizePty changes the side of the task's PTY to the provided width and height