...

Source file src/github.com/Microsoft/hcsshim/cmd/wclayer/remove.go

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

     1  //go:build windows
     2  
     3  package main
     4  
     5  import (
     6  	"path/filepath"
     7  
     8  	winio "github.com/Microsoft/go-winio"
     9  	"github.com/Microsoft/hcsshim"
    10  	"github.com/Microsoft/hcsshim/internal/appargs"
    11  
    12  	"github.com/urfave/cli"
    13  )
    14  
    15  var removeCommand = cli.Command{
    16  	Name:      "remove",
    17  	Usage:     "permanently removes a layer directory in its entirety",
    18  	ArgsUsage: "<layer path>",
    19  	Before:    appargs.Validate(appargs.NonEmptyString),
    20  	Action: func(context *cli.Context) (err error) {
    21  		path, err := filepath.Abs(context.Args().First())
    22  		if err != nil {
    23  			return err
    24  		}
    25  
    26  		err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege})
    27  		if err != nil {
    28  			return err
    29  		}
    30  
    31  		return hcsshim.DestroyLayer(driverInfo, path)
    32  	},
    33  }
    34  

View as plain text