main.go raw
1 package main
2
3 import (
4 "fmt"
5 "time"
6
7 "github.com/p9c/p9/pkg/qu"
8
9 "github.com/p9c/p9/pkg/pipe"
10 )
11
12 func main() {
13 quit := qu.T()
14 p := pipe.Consume(
15 quit, func(b []byte) (e error) {
16 fmt.Println("from child:", string(b))
17 return
18 }, "go", "run", "serve/main.go",
19 )
20 for {
21 _, e := p.StdConn.Write([]byte("ping"))
22 if e != nil {
23 fmt.Println("err:", e)
24 }
25 time.Sleep(time.Second)
26 }
27 }
28