Skip to content

Commit 8e598fc

Browse files
committed
Check that process exists before it is returned
Signed-off-by: Michael Crosby <[email protected]>
1 parent c07ede4 commit 8e598fc

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

linux/task.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,14 @@ func (t *Task) Update(ctx context.Context, resources *types.Any) error {
282282

283283
// Process returns a specific process inside the task by the process id
284284
func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) {
285-
// TODO: verify process exists for container
286-
return &Process{
285+
p := &Process{
287286
id: id,
288287
t: t,
289-
}, nil
288+
}
289+
if _, err := p.State(ctx); err != nil {
290+
return nil, err
291+
}
292+
return p, nil
290293
}
291294

292295
// Metrics returns runtime specific system level metric information for the task

0 commit comments

Comments
 (0)