blob: 8d2adaf06445d2cf547dc3b3265e3fc79117f8c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package procs_test
import (
"fmt"
"github.com/ionrock/procs"
)
func Example() {
b := procs.Builder{
Context: map[string]string{
"NAME": "eric",
},
Templates: []string{
"echo $NAME |",
"grep $NAME",
},
}
cmd := b.Command()
fmt.Println(cmd)
p := procs.NewProcess(cmd)
p.Run()
out, _ := p.Output()
fmt.Println(string(out))
// Output:
// echo eric | grep eric
// eric
}
|