Merge pull request #1 from crosbymichael/runtime-v2-windows
Add Windows Publisher and Signal Handler
This commit is contained in:
commit
965cca6f75
@ -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"
|
||||
)
|
||||
@ -33,7 +37,6 @@ import (
|
||||
// setupSignals creates a new signal handler for all signals
|
||||
func setupSignals() (chan os.Signal, error) {
|
||||
signals := make(chan os.Signal, 32)
|
||||
// TODO: JTERRY75: Make this based on events.
|
||||
return signals, nil
|
||||
}
|
||||
|
||||
@ -63,12 +66,11 @@ func serveListener(path string) (net.Listener, string, error) {
|
||||
}
|
||||
|
||||
func handleSignals(logger *logrus.Entry, signals chan os.Signal) error {
|
||||
// TODO: JTERRY75: Make this based on events?
|
||||
<-signals
|
||||
return nil
|
||||
}
|
||||
|
||||
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 +82,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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user