containerd/vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_state.go
Amit Barve daa1ea522b Add cimfs differ and snapshotter
Details about CimFs project are discussed in #8346

Signed-off-by: Amit Barve <ambarve@microsoft.com>
2023-12-20 09:29:08 -08:00

23 lines
484 B
Go

//go:build windows
package runhcs
import (
"context"
"encoding/json"
"fmt"
)
// State outputs the state of a container.
func (r *Runhcs) State(ctx context.Context, id string) (*ContainerState, error) {
data, err := cmdOutput(r.command(ctx, "state", id), true)
if err != nil {
return nil, fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
}
var out ContainerState
if err := json.Unmarshal(data, &out); err != nil {
return nil, err
}
return &out, nil
}