1 //go:build windows 2 3 package runhcs 4 5 import ( 6 "context" 7 "encoding/json" 8 "fmt" 9 ) 10 11 // State outputs the state of a container. 12 func (r *Runhcs) State(context context.Context, id string) (*ContainerState, error) { 13 data, err := cmdOutput(r.command(context, "state", id), true) 14 if err != nil { 15 return nil, fmt.Errorf("%s: %s", err, data) 16 } 17 var out ContainerState 18 if err := json.Unmarshal(data, &out); err != nil { 19 return nil, err 20 } 21 return &out, nil 22 } 23