From 8e598fcb21a41dcdb28046981d69ef1fda171112 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 18 Dec 2017 15:59:37 -0500 Subject: [PATCH] Check that process exists before it is returned Signed-off-by: Michael Crosby --- linux/task.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/linux/task.go b/linux/task.go index 85327cac3..4d1e93fb1 100644 --- a/linux/task.go +++ b/linux/task.go @@ -282,11 +282,14 @@ func (t *Task) Update(ctx context.Context, resources *types.Any) error { // Process returns a specific process inside the task by the process id func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) { - // TODO: verify process exists for container - return &Process{ + p := &Process{ id: id, t: t, - }, nil + } + if _, err := p.State(ctx); err != nil { + return nil, err + } + return p, nil } // Metrics returns runtime specific system level metric information for the task