...

Source file src/github.com/Microsoft/hcsshim/cmd/runhcs/pause.go

Documentation: github.com/Microsoft/hcsshim/cmd/runhcs

     1  //go:build windows
     2  
     3  package main
     4  
     5  import (
     6  	gcontext "context"
     7  
     8  	"github.com/Microsoft/hcsshim/internal/appargs"
     9  	"github.com/urfave/cli"
    10  )
    11  
    12  var pauseCommand = cli.Command{
    13  	Name:  "pause",
    14  	Usage: "pause suspends all processes inside the container",
    15  	ArgsUsage: `<container-id>
    16  
    17  Where "<container-id>" is the name for the instance of the container to be
    18  paused. `,
    19  	Description: `The pause command suspends all processes in the instance of the container.
    20  
    21  Use runhcs list to identify instances of containers and their current status.`,
    22  	Before: appargs.Validate(argID),
    23  	Action: func(context *cli.Context) error {
    24  		id := context.Args().First()
    25  		container, err := getContainer(id, true)
    26  		if err != nil {
    27  			return err
    28  		}
    29  		defer container.Close()
    30  		if err := container.hc.Pause(gcontext.Background()); err != nil {
    31  			return err
    32  		}
    33  
    34  		return nil
    35  	},
    36  }
    37  
    38  var resumeCommand = cli.Command{
    39  	Name:  "resume",
    40  	Usage: "resumes all processes that have been previously paused",
    41  	ArgsUsage: `<container-id>
    42  
    43  Where "<container-id>" is the name for the instance of the container to be
    44  resumed.`,
    45  	Description: `The resume command resumes all processes in the instance of the container.
    46  
    47  Use runhcs list to identify instances of containers and their current status.`,
    48  	Before: appargs.Validate(argID),
    49  	Action: func(context *cli.Context) error {
    50  		id := context.Args().First()
    51  		container, err := getContainer(id, true)
    52  		if err != nil {
    53  			return err
    54  		}
    55  		defer container.Close()
    56  		if err := container.hc.Resume(gcontext.Background()); err != nil {
    57  			return err
    58  		}
    59  
    60  		return nil
    61  	},
    62  }
    63  

View as plain text