Add exec id check on client

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-07-12 10:41:04 -07:00
parent 96b041e1f9
commit cd4e8ba448
2 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ var (
ErrNoRunningTask = errors.New("no running task") ErrNoRunningTask = errors.New("no running task")
ErrDeleteRunningTask = errors.New("cannot delete container with running task") ErrDeleteRunningTask = errors.New("cannot delete container with running task")
ErrProcessExited = errors.New("process already exited") ErrProcessExited = errors.New("process already exited")
ErrNoExecID = errors.New("exec id must be provided")
) )
type DeleteOpts func(context.Context, *Client, containers.Container) error type DeleteOpts func(context.Context, *Client, containers.Container) error

View File

@ -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) { func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) {
if id == "" {
return nil, ErrNoExecID
}
i, err := ioCreate() i, err := ioCreate()
if err != nil { if err != nil {
return nil, err return nil, err