Use context.Background for runtime.Wait. (#28)

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2019-05-15 10:43:22 +09:00
committed by Ian Lewis
parent 97875daf63
commit c66bc73ecb
+6 -6
View File
@@ -225,21 +225,21 @@ func (p *Init) Start(ctx context.Context) error {
return p.initState.Start(ctx)
}
func (p *Init) start(context context.Context) error {
func (p *Init) start(ctx context.Context) error {
var cio runc.IO
if !p.Sandbox {
cio = p.io
}
if err := p.runtime.Start(context, p.id, cio); err != nil {
if err := p.runtime.Start(ctx, p.id, cio); err != nil {
return p.runtimeError(err, "OCI runtime start failed")
}
go func() {
status, err := p.runtime.Wait(context, p.id)
status, err := p.runtime.Wait(context.Background(), p.id)
if err != nil {
log.G(context).WithError(err).Errorf("Failed to wait for container %q", p.id)
log.G(ctx).WithError(err).Errorf("Failed to wait for container %q", p.id)
// TODO(random-liu): Handle runsc kill error.
if err := p.killAll(context); err != nil {
log.G(context).WithError(err).Errorf("Failed to kill container %q", p.id)
if err := p.killAll(ctx); err != nil {
log.G(ctx).WithError(err).Errorf("Failed to kill container %q", p.id)
}
status = internalErrorCode
}