func prepareFuncFactory(i *Instance) func(*exec.Cmd) { return func(cmd *exec.Cmd) { cmd.Stderr = os.Stderr w, _ := cmd.StdinPipe() r, _ := cmd.StdoutPipe() i.rp = pipe.NewInterProcess(r, nil) i.wp = pipe.NewInterProcess(nil, w) i.Start() } }
func (p *plugin) Run() { p.pipe = pipe.NewInterProcess(nil, os.Stdout) // Redirect os.Stdout, because plugins maybe write to stdout r, w, err := os.Pipe() if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } os.Stdout = w go p.stdoutTransfer(r) go p.signalHandler() p.eventLoop(pipe.NewInterProcess(os.Stdin, nil)) }