Skip to content

Commit

Permalink
Fix cross-compile on windows
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hiltgen <[email protected]>
  • Loading branch information
Daniel Hiltgen committed Aug 2, 2018
1 parent b21fb3d commit a789b14
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cli/containerdutils/hostpaths.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/containerd/containerd/cio"
"github.com/docker/docker/pkg/stringid"
specs "github.com/opencontainers/runtime-spec/specs-go"
"golang.org/x/sys/unix"
)

// VerifyHostDirExists ensures that the desired directory exists on the host
Expand Down Expand Up @@ -78,7 +77,7 @@ func VerifyHostDirExists(ctx context.Context, client WrappedContainerdClient, di
task, err := container.NewTask(ctx, cio.NullIO)
if err == nil {
// Path exists, kill the task and proceed to clean up
err = task.Kill(ctx, unix.SIGKILL)
err = task.Kill(ctx, SIGKILL)
if err != nil && !strings.Contains(err.Error(), "not found") {
return fmt.Errorf("failed to kill task: %s", err)
}
Expand Down Expand Up @@ -159,7 +158,7 @@ func VerifyHostDirExists(ctx context.Context, client WrappedContainerdClient, di
logrus.Fatalf("Failed to wait for container task: %s", err)
}
<-status
err = task.Kill(ctx, unix.SIGKILL)
err = task.Kill(ctx, SIGKILL)
if err != nil && !strings.Contains(err.Error(), "not found") {
return fmt.Errorf("failed to kill task: %s", err)
}
Expand Down Expand Up @@ -248,7 +247,7 @@ func VerifyDockerConfig(ctx context.Context, client WrappedContainerdClient, con
return fmt.Errorf("Failed to wait for container task: %s", err)
}
<-status
err = task.Kill(ctx, unix.SIGKILL)
err = task.Kill(ctx, SIGKILL)
if err != nil {
logrus.Debugf("Failed to kill task: %s", err)
}
Expand Down
12 changes: 12 additions & 0 deletions cli/containerdutils/signal_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build !windows

package containerdutils

import (
"golang.org/x/sys/unix"
)

var (
// SIGKILL maps to unix.SIGKILL
SIGKILL = unix.SIGKILL
)
12 changes: 12 additions & 0 deletions cli/containerdutils/signal_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build windows

package containerdutils

import (
"syscall"
)

var (
// SIGKILL all signals are ignored by containerd kill windows
SIGKILL = syscall.Signal(0)
)

0 comments on commit a789b14

Please sign in to comment.