...

Source file src/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_ps.go

Documentation: github.com/Microsoft/hcsshim/pkg/go-runhcs

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

View as plain text