From cd4e8ba4485ba84876f30be4189019a527e8ea88 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 12 Jul 2017 10:41:04 -0700 Subject: [PATCH] Add exec id check on client Signed-off-by: Michael Crosby --- container.go | 1 + task.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/container.go b/container.go index 684d23856..8e5c4278e 100644 --- a/container.go +++ b/container.go @@ -23,6 +23,7 @@ var ( ErrNoRunningTask = errors.New("no running task") ErrDeleteRunningTask = errors.New("cannot delete container with running task") ErrProcessExited = errors.New("process already exited") + ErrNoExecID = errors.New("exec id must be provided") ) type DeleteOpts func(context.Context, *Client, containers.Container) error diff --git a/task.go b/task.go index 03305eb20..262678f65 100644 --- a/task.go +++ b/task.go @@ -191,6 +191,9 @@ func (t *task) Delete(ctx context.Context) (uint32, error) { } func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) { + if id == "" { + return nil, ErrNoExecID + } i, err := ioCreate() if err != nil { return nil, err