Import from weave-npc repo

This commit is contained in:
Adam Harrison committed 2016-11-02 11:28:59 +00:00
1 parent b533a11bee
commit 19088ba8bc
22 files changed
+1425 -5

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package ulogd
import (
log "github.com/Sirupsen/logrus"
"io"
"os"
"os/exec"
)
func waitForExit(cmd *exec.Cmd) {
if err := cmd.Wait(); err != nil {
log.Fatalf("ulogd terminated: %v", err)
}
log.Fatal("ulogd terminated normally")
}
func Start() error {
cmd := exec.Command("/usr/sbin/ulogd", "-v")
stdout, err := cmd.StderrPipe()
if err != nil {
return err
}
if err := cmd.Start(); err != nil {
return err
}
go io.Copy(os.Stdout, stdout)
go waitForExit(cmd)
return nil
}