From f15a1170d368f9fce9639dff2c2edba714daba9c Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Thu, 26 Jul 2018 11:21:50 -0400 Subject: [PATCH] Add windows publisher Signed-off-by: Michael Crosby --- runtime/v2/shim/shim_windows.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/runtime/v2/shim/shim_windows.go b/runtime/v2/shim/shim_windows.go index ff49cb303..7827b25ad 100644 --- a/runtime/v2/shim/shim_windows.go +++ b/runtime/v2/shim/shim_windows.go @@ -19,13 +19,17 @@ package shim import ( + "bytes" "context" "net" "os" + "os/exec" winio "github.com/Microsoft/go-winio" "github.com/containerd/containerd/events" + "github.com/containerd/containerd/namespaces" "github.com/containerd/ttrpc" + "github.com/containerd/typeurl" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -68,7 +72,6 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal) error { } func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error { - /* TOOD: JTERRY75: Implement publish for windows ns, _ := namespaces.Namespace(ctx) encoded, err := typeurl.MarshalAny(event) if err != nil { @@ -80,17 +83,5 @@ func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event } cmd := exec.CommandContext(ctx, l.containerdBinaryPath, "--address", l.address, "publish", "--topic", topic, "--namespace", ns) cmd.Stdin = bytes.NewReader(data) - c, err := Default.Start(cmd) - if err != nil { - return err - } - status, err := Default.Wait(cmd, c) - if err != nil { - return err - } - if status != 0 { - return errors.New("failed to publish event") - } - */ - return nil + return cmd.Run() }