()
| 418 | } |
| 419 | |
| 420 | func (h *containerHandler) GetExitCode() (int, error) { |
| 421 | res, err := h.client.ContainerInspect(context.Background(), h.reference.Id, dclient.ContainerInspectOptions{}) |
| 422 | if err != nil { |
| 423 | return -1, fmt.Errorf("failed to inspect container %s: %w", h.reference.Id, err) |
| 424 | } |
| 425 | ctnr := res.Container |
| 426 | |
| 427 | if ctnr.State.Running { |
| 428 | return -1, fmt.Errorf("container %s is still running", h.reference.Id) |
| 429 | } |
| 430 | |
| 431 | return ctnr.State.ExitCode, nil |
| 432 | } |