Skip to content

Commit

Permalink
fix windows oci package
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
  • Loading branch information
dnephin committed Nov 27, 2017
1 parent cdf62f6 commit a21a19a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
21 changes: 11 additions & 10 deletions helpers_windows_test.go
Expand Up @@ -7,28 +7,29 @@ import (
"strconv"

"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/oci"
specs "github.com/opencontainers/runtime-spec/specs-go"
)

const newLine = "\r\n"

func withExitStatus(es int) SpecOpts {
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
func withExitStatus(es int) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Process.Args = []string{"powershell", "-noprofile", "exit", strconv.Itoa(es)}
return nil
}
}

func withProcessArgs(args ...string) SpecOpts {
return WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
func withProcessArgs(args ...string) oci.SpecOpts {
return oci.WithProcessArgs(append([]string{"powershell", "-noprofile"}, args...)...)
}

func withCat() SpecOpts {
return WithProcessArgs("cmd", "/c", "more")
func withCat() oci.SpecOpts {
return oci.WithProcessArgs("cmd", "/c", "more")
}

func withTrue() SpecOpts {
return WithProcessArgs("cmd", "/c")
func withTrue() oci.SpecOpts {
return oci.WithProcessArgs("cmd", "/c")
}

func withExecExitStatus(s *specs.Process, es int) {
Expand All @@ -39,8 +40,8 @@ func withExecArgs(s *specs.Process, args ...string) {
s.Args = append([]string{"powershell", "-noprofile"}, args...)
}

func withImageConfig(i Image) SpecOpts {
return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error {
func withImageConfig(i Image) oci.SpecOpts {
return func(_ context.Context, _ oci.Client, _ *containers.Container, s *specs.Spec) error {
s.Windows.LayerFolders = dockerLayerFolders
return nil
}
Expand Down
1 change: 0 additions & 1 deletion oci/spec_opts_windows.go
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/containerd/containerd/containers"
"github.com/containerd/containerd/content"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/platforms"
"github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
)
Expand Down
2 changes: 1 addition & 1 deletion task_opts_windows.go
Expand Up @@ -8,7 +8,7 @@ import (

// WithResources sets the provided resources on the spec for task updates
func WithResources(resources *specs.WindowsResources) UpdateTaskOpts {
return func(ctx context.Context, client Client, r *UpdateTaskInfo) error {
return func(ctx context.Context, client *Client, r *UpdateTaskInfo) error {
r.Resources = resources
return nil
}
Expand Down

0 comments on commit a21a19a

Please sign in to comment.