X Tutup
Skip to content

Commit cd4e8ba

Browse files
committed
Add exec id check on client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
1 parent 96b041e commit cd4e8ba

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

container.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var (
2323
ErrNoRunningTask = errors.New("no running task")
2424
ErrDeleteRunningTask = errors.New("cannot delete container with running task")
2525
ErrProcessExited = errors.New("process already exited")
26+
ErrNoExecID = errors.New("exec id must be provided")
2627
)
2728

2829
type DeleteOpts func(context.Context, *Client, containers.Container) error

task.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ func (t *task) Delete(ctx context.Context) (uint32, error) {
191191
}
192192

193193
func (t *task) Exec(ctx context.Context, id string, spec *specs.Process, ioCreate IOCreation) (Process, error) {
194+
if id == "" {
195+
return nil, ErrNoExecID
196+
}
194197
i, err := ioCreate()
195198
if err != nil {
196199
return nil, err

0 commit comments

Comments
 (0)
X Tutup