diff --git a/process.go b/process.go index ff7d838cde..42f3b84a9b 100644 --- a/process.go +++ b/process.go @@ -111,9 +111,11 @@ func (p *process) Start(ctx context.Context) error { ExecID: p.id, }) if err != nil { - p.io.Cancel() - p.io.Wait() - p.io.Close() + if p.io != nil { + p.io.Cancel() + p.io.Wait() + p.io.Close() + } return errdefs.FromGRPC(err) } p.pid = r.Pid diff --git a/task.go b/task.go index 6806e11620..1fbd1cc164 100644 --- a/task.go +++ b/task.go @@ -185,8 +185,10 @@ func (t *task) Start(ctx context.Context) error { ContainerID: t.id, }) if err != nil { - t.io.Cancel() - t.io.Close() + if t.io != nil { + t.io.Cancel() + t.io.Close() + } return errdefs.FromGRPC(err) } t.pid = r.Pid