(ctx context.Context, ioAttach cio.Attach)
| 477 | } |
| 478 | |
| 479 | func (c *container) loadTask(ctx context.Context, ioAttach cio.Attach) (Task, error) { |
| 480 | response, err := c.client.TaskService().Get(ctx, &tasks.GetRequest{ |
| 481 | ContainerID: c.id, |
| 482 | }) |
| 483 | if err != nil { |
| 484 | err = errgrpc.ToNative(err) |
| 485 | if errdefs.IsNotFound(err) { |
| 486 | return nil, fmt.Errorf("no running task found: %w", err) |
| 487 | } |
| 488 | return nil, err |
| 489 | } |
| 490 | var i cio.IO |
| 491 | if ioAttach != nil && response.Process.Status != tasktypes.Status_UNKNOWN { |
| 492 | // Do not attach IO for task in unknown state, because there |
| 493 | // are no fifo paths anyway. |
| 494 | if i, err = attachExistingIO(response, ioAttach); err != nil { |
| 495 | return nil, err |
| 496 | } |
| 497 | } |
| 498 | t := &task{ |
| 499 | client: c.client, |
| 500 | io: i, |
| 501 | id: response.Process.ID, |
| 502 | pid: response.Process.Pid, |
| 503 | c: c, |
| 504 | } |
| 505 | return t, nil |
| 506 | } |
| 507 | |
| 508 | func (c *container) get(ctx context.Context) (containers.Container, error) { |
| 509 | return c.client.ContainerService().Get(ctx, c.id) |
no test coverage detected